stratos
This server provides CloudCDN control-plane, analytics, AI, and sustainability tools.
Check API health, optionally deep-probing bindings.
Purge cached URLs, tags, or the whole zone.
List catalogue assets, search assets, and rank top requested assets.
Summarise traffic, query edge logs, and estimate cost, energy, and CO2e.
Generate image alt text and moderate images for safety.
Mint offline HMAC-SHA256 signed URLs for private files.
Contents
Getting started
Install — eight channels, SHA-pinned installer
Quick Start — verify, authenticate, purge in five lines
Why a single-file CLI? — design rationale
Companion artefacts
Companion artefacts — composite GitHub Action, MCP server, Docker image
Migrating from another CDN CLI — Wrangler, Fastly CLI, Codex CLI
CLI reference
Capabilities — release inventory
Authentication & profiles — env, profile, keychain
Commands — full command table
Programmatic API — drive Stratos in-process
MCP server — agent integration
Machine-readable schema —
stratos schemaOutput, exit codes, typed errors — pipeline contract
Operational
Related MCP server: EDS MCP Server
Install
Stratos ships as one ES module (stratos.mjs, ~4,000 lines, zero runtime dependencies). Eight distribution channels:
Channel | Command |
npm (recommended) |
|
Homebrew (macOS / Linux, no Node required) |
|
winget (Windows) |
|
Scoop (Windows) |
|
Single binary (no Node required) | Download from the latest release — |
macOS / Linux installer |
|
Windows (PowerShell) |
|
From source |
|
Override the installer prefix:
curl -sL https://cloudcdn.pro/dist/stratos/install.sh | STRATOS_PREFIX=$HOME/bin bashBoth shell installers verify a pinned SHA-256 of the script before writing it to disk. npm releases are published with Sigstore-backed provenance — verify with npm audit signatures. The one exception is 0.0.22, the first version under the @sebastienrousseau/stratos name, which was published by hand because npm can only trust a release workflow for a package that already exists; its GitHub release artefacts carry the usual SLSA attestation and Cosign signatures. Every release also ships a SLSA L3 build provenance attestation (stratos-v<version>.intoto.jsonl) and a Cosign keyless signature for each canonical artefact — see Integrity & supply chain.
Module format:
@sebastienrousseau/stratosis ESM only ("type": "module"). Modern Node ≥ 20 consumes it directly withimport. CommonJS callers use dynamic import:const stratos = await import('@sebastienrousseau/stratos').
Quick Start
# Verify the install
stratos version
# → stratos v0.0.17
# Hit the public health endpoint
stratos health
# → { "status": "ok", "bindings": { "ai": true, "kv": true, "d1": true, "r2": true } }
# Set up tab completion (zsh shown; bash/fish/powershell also supported)
eval "$(stratos completion zsh)"
# Authenticate once, then drive the control plane
export CLOUDCDN_ACCOUNT_KEY="cdnsk_…"
stratos purge https://cloudcdn.pro/akande/v1/logos/logo.svg
stratos purge --tag "build-${GITHUB_SHA}" --tag project-akande
cat urls.txt | stratos purge - # batch invalidate from stdin
# Stream NDJSON into jq for downstream pipelines
stratos assets --all --output ndjson | jq -r '.Path'
# Introspect the surface (agent caller's gateway)
stratos schema --output ndjson | jq -r 'select(.mcp_tool) | "\(.name) → \(.mcp_tool)"'In-terminal demos
Command | Cast |
| |
| |
|
Re-record any cast with
node scripts/make-casts.mjs --render— needsagg(brew install agg).
Why a single-file CLI?
Most edge-platform CLIs ship as 30–80 MB Node bundles with hundreds of transitive dependencies. Stratos takes a deliberately different bet:
One file —
stratos.mjsis the entire CLI. No build step. No transpiler. The thing that runs is the thing you read.Zero runtime dependencies — only Node ≥ 20 standard library. No transitive supply-chain exposure. Zero
node_modulesin the install footprint.One SHA-pin — installers verify a single SHA-256 of the script before touching disk. Tampered CDN responses fail the check before anything is executed.
Cold-start under 70 ms on M-series — measured by
stratos bench. Suitable for CI hot loops and shell pipelines.Errors to stderr, machine output to stdout — pipelines like
stratos assets --output ndjson | jq …stay clean.Sysexits-style exit codes and stable typed errors —
makeand shell||chains can branch on cause (64 USAGE,77 NOPERM,75 TEMPFAIL, …); agents drive backoff loops fromerror.typeanderror.retryable.CLI is also a library — every command is an exported ESM function; the test suite drives it in-process and you can too.
If those trade-offs match what you need, read on. If you'd prefer a richer SDK with a build pipeline, see When not to use Stratos.
Companion artefacts
Three artefacts ship from this repo. The CLI is the core; the others wrap it for specific delivery surfaces.
Artefact | What it is | Use case |
| The CLI and library (this README) | Local terminal, CI, scripts, in-process integration |
| Composite GitHub Action | Drop-in CI step; auto-detects |
| Model Context Protocol stdio server (bundled) | Claude Code, Cursor, Continue.dev, Zed assistant, any MCP host — see MCP server |
| Multi-arch Docker image ( | Containerised CI runners; |
Migrating from another CDN CLI
Three step-by-step guides covering the equivalent commands, authentication mapping, and behavioural differences:
Coming from… | Guide |
Cloudflare Wrangler | |
Fastly CLI | |
OpenAI Codex CLI (agentic-CLI patterns) |
Agent harnesses can introspect Stratos's full verb + error surface in one call via
stratos schema --output ndjson— no--helpparsing required. See Machine-readable schema.
Capabilities
Stratos covers ~35 commands across the full CloudCDN platform, grouped by concern.
Theme | Capabilities |
Edge cache | URL / Cache-Tag / wildcard purge, dry-run preview, stdin batching, offline HMAC-SHA256 signed URLs that |
Catalog & analytics | Paginated asset catalogue with |
Multi-tenancy | Zone create / list / show / delete, custom-domain attachment |
Config-as-code |
|
Auth & secrets | Scoped API tokens, webhook subscriptions, |
Storage | Single-file CRUD plus recursive |
Observability | SSE-streamed live |
AI & media | Alt-text, moderation, smart-crop, background-remove; on-the-fly image |
Pipeline & discovery | SVG-driven asset scaffolding, hybrid vector + fuzzy |
Agent integration |
|
Operator UX | Shell completions (bash/zsh/fish/PowerShell), XDG-compliant profiles, |
Authentication & profiles
Configuration is resolved from four sources, highest precedence first:
Per-command flags —
--account-key,--access-key,--cdn-url,--secret,--timeout,--retries,--profile.Environment variables — see table below.
Profile file —
~/.config/stratos/config.json(XDG-compliant), selected with--profile <name>or$STRATOS_PROFILE.OS keychain — populated via
stratos login; suppressed bySTRATOS_NO_KEYCHAIN=1.
Env var | Purpose | Default |
| API base URL |
|
| Control plane: purge, zones, rules, tokens, webhooks | unset |
| Read-only: assets, insights, search | unset |
| HMAC secret for | unset |
| Default profile name |
|
| Per-request timeout, ms |
|
| Max retries on 429 / 5xx / network |
|
| Set to | unset |
| OTLP/HTTP traces endpoint (alt to | unset |
| OTLP exporter headers ( | unset |
| Set to disable ANSI output | unset |
Profile setup is round-trippable via stratos config:
stratos config set prod.url https://cloudcdn.pro
stratos config set prod.account_key cdnsk_xxx…
stratos config set staging.url https://staging.cloudcdn.example
stratos config list
# Then everywhere:
stratos --profile prod purge --tag build-123
STRATOS_PROFILE=staging stratos health --deepThe config file is written with permission mode 0600.
For the most secure setup, store keys in the OS keychain instead:
stratos login # interactive prompt; writes to macOS Keychain / libsecret / cmdkey
stratos login status # show resolved config with secrets masked
stratos logout # clear all stratos secrets from the keychainCommands
Edge ops
Command | What it does |
| Print version |
| Print help; per-command |
|
|
| Invalidate by URL |
| Invalidate by Cache-Tag (repeats accumulate) |
| Wipe edge cache (hard-rate-limited) |
| Preview the payload without sending |
| Read URLs from stdin (one per line) |
| Offline HMAC-SHA256 signed URL, checked by |
Catalog & insights
Command | What it does |
| Paginated catalogue; |
| Single-asset metadata |
| Requests, bandwidth, cache ratio |
| Top requested assets |
| Per-asset traffic |
| 4xx / 5xx breakdown |
| Country distribution |
|
|
|
|
| Immutable audit trail |
Zones, rules, tokens, webhooks
Command | What it does |
| Tenant zones |
| Add a custom domain |
| Read the edge config file |
| Write it back via Git |
| LCS line diff; exits 0 if identical, 69 on drift |
| Scoped API tokens |
| Event subscriptions |
Storage
Command | What it does |
| Single-file upload |
| Download (stdout if no |
| Delete |
| List under a prefix |
| Recursive upload via |
AI, image, media
Command | What it does |
| AI vision endpoints |
| Resize / convert |
| BlurHash placeholder |
| Tiny blurred placeholder |
| Format negotiation |
| HLS playlist or segment URL |
Pipeline & discovery
Command | What it does |
| Asset scaffold from an SVG |
| Hybrid asset search |
| CloudCDN AI concierge |
| SSE-stream live logs |
| Historical logs |
Meta
Command | What it does |
| Interactive first-run setup; scriptable via flags |
| Machine-readable command catalogue (drives MCP tool registration, completion, doc generation) |
| Emit completion script |
| Re-run the latest pinned installer |
| Profile management; |
| Store keys in the OS keychain |
| WebAuthn ceremony bootstrapper (browser) |
| Diagnose env, credentials, network |
| Cold-start + N latency samples |
| Cause + fix for an exit code or HTTP status |
| Run as an MCP server over stdio (12 tools, 6 resources, 4 prompts) |
Global options
--json (force JSON), --no-json (opt out of CI auto-JSON), --output <fmt> (json / ndjson / yaml / csv / table; jsonl is an alias for ndjson), --filter <jq-expr> (pipe output through jq), -q / --quiet (suppress info), --no-quiet (opt out of CI auto-quiet), --verbose (trace requests), --profile <name>, --cdn-url <url>, --account-key <key>, --access-key <key>, --timeout <ms>, --retries <n>, --rate <n>[/s] (client-side rate limit for bulk ops), --otlp-endpoint <url>, --otlp-headers k=v,k=v.
When CI is detected (GITHUB_ACTIONS, GITLAB_CI, CIRCLECI, JENKINS_URL, TF_BUILD, or CI=true), Stratos auto-enables --json --quiet and, on GitHub Actions, emits ::error:: workflow commands on non-zero exit so failures surface inline on PR/run pages. Override with STRATOS_CI=0.
Run stratos <command> --help for per-command detail.
Programmatic API
Stratos is also a Node ESM library. Every command is an exported function you can drive in-process from your own application or test suite.
ESM only. Use
importfrom any Node ≥ 20 ES module. CommonJS callers useawait import('@sebastienrousseau/stratos').
Minting a signed URL from your application
// signed-url-server.mjs — mint short-lived signed URLs from an Express handler.
import { cmdSigned } from '@sebastienrousseau/stratos';
import express from 'express';
const app = express();
app.get('/preview/:client/:file', async (req, res) => {
// cmdSigned writes the URL to process.stdout, so capture stdout briefly.
const captured = [];
const originalWrite = process.stdout.write.bind(process.stdout);
process.stdout.write = (chunk) => { captured.push(chunk); return true; };
try {
const expires = Math.floor(Date.now() / 1000) + 600; // 10 minutes
await cmdSigned(
[`/clients/${req.params.client}/${req.params.file}`],
{ expires, secret: process.env.SIGNED_URL_SECRET },
);
} finally {
process.stdout.write = originalWrite;
}
res.redirect(302, captured.join('').trim());
});
app.listen(3000);Parsing CLI-style flags in your own tool
// custom-tool.mjs — reuse Stratos's flag parser for consistency with the CLI.
import { parseFlags } from '@sebastienrousseau/stratos';
const { positional, flags } = parseFlags(process.argv.slice(2));
// e.g. node custom-tool.mjs deploy --env=prod --tag a --tag b
// → positional = ['deploy']
// → flags = { env: 'prod', tag: ['a', 'b'] }
console.log({ positional, flags });Driving the full router (for test harnesses)
// integration-test.mjs — invoke any command in-process.
import { main, VERSION, EX } from '@sebastienrousseau/stratos';
console.log(`Driving stratos v${VERSION}`); // → Driving stratos v0.0.17
console.log(`Exit codes: ${JSON.stringify(EX)}`); // → { OK: 0, USAGE: 64, ... }
// Same argv shape as the CLI; same exits, same stdout/stderr discipline.
await main(['health', '--cdn-url', 'http://localhost:8788', '--json']);Public exports
Symbol | Kind | Purpose |
|
| The full CLI router (drives every subcommand) |
|
|
|
|
| Retrying, auth-aware |
|
| Resolve |
|
| The in-process-driveable subset of CLI subcommands |
|
| The 12 tools exposed over MCP |
|
| Invoke an MCP tool in-process |
|
| e.g. |
|
| Sysexits-style exit-code constants |
Every export carries full JSDoc (parameters, returns, throws). IDE hover and TypeDoc-generated docs work out of the box.
MCP server
Stratos speaks Model Context Protocol over stdio, exposing 12 CloudCDN tools (purge, assets, insights, AI vision, signed URLs, search, log query, cost, carbon, …) to any MCP host.
Claude Code — add to ~/.claude.json:
{
"mcpServers": {
"cloudcdn": {
"command": "stratos",
"args": ["mcp", "serve"],
"env": {
"CLOUDCDN_ACCOUNT_KEY": "cdnsk_…",
"CLOUDCDN_ACCESS_KEY": "cdnsk_…"
}
}
}
}Cursor / Continue / any MCP host — same shape; point at stratos mcp serve.
The server inherits env vars from the host process, so a CLOUDCDN_ACCOUNT_KEY already exported in your shell is what the agent calls with. See examples/mcp-claude-code.md for prompts that work well and a debugging walkthrough.
Machine-readable schema
stratos schema emits the full command surface as a structured catalogue. Drives MCP tool registration, shell completion, doc generation, and external agent introspection from a single source of truth.
# Per-command shape
stratos schema --output ndjson | jq -c 'select(.name == "purge")'
# → {"name":"purge","summary":"Invalidate cache by URL, tag, or wholesale.",
# "usage":"stratos purge <url>... [--dry-run]",
# "exits":[0,64,69,75,77,78],"since":"0.0.1","mcp_tool":"cloudcdn_purge"}
# Top-level wrapper
stratos schema | jq 'keys'
# → ["$schema","commands","error_types","homepage","tool","version"]
# Discover only MCP-exposed commands
stratos schema --output ndjson | jq -r 'select(.mcp_tool) | .name'
# → health, purge, signed, assets, insights, ai, search, logs (10 total)The output is deterministic — byte-identical across runs given the same source, so it's safe to cache, hash, or attest. The error_types field includes the stable typed-error registry so an agent gets both the verb surface and the error contract in one document.
Output, exit codes, typed errors
Output. Default is pretty JSON on TTY, compact JSON on pipe. List-shaped commands (assets, zones, tokens, …) render an aligned table on TTY and JSON when piped or with --json. Use --output ndjson to stream one record per line (alias jsonl); pipes cleanly into jq -c, DuckDB read_ndjson, or an LLM context window without buffering an array. Diagnostics (info:, warning:, error:) go to stderr, never stdout.
Exit codes (sysexits-style):
Code | Meaning |
| Success |
| Usage / bad CLI args |
| Data error — malformed input or response |
| Service unavailable (4xx other than auth) |
| Software error (uncaught exception) |
| Local I/O failure |
| Tempfail — 5xx, 429, or network after retries exhausted |
| Permission denied (401 / 403) |
| Config error (missing key, unreadable config file) |
| Interrupted (SIGINT) |
Programmatic consumers can import EX for these constants.
Stable typed errors. When --json or any structured --output is set, failures emit a typed envelope on stderr that agents can parse without regex-matching on human strings:
stratos signed --json
# stderr: {"error":{"type":"usage_error","message":"signed needs a path argument.",
# "retryable":false,"exit_code":64}}# HTTP-status → type inference via emitFailure()
stratos health --json --retries 0 --cdn-url http://127.0.0.1:1
# stderr: {"error":{"type":"request_failed","message":"...","retryable":true,
# "exit_code":75}}
| When |
| Exit |
| Invalid CLI invocation |
|
|
| Required credential not configured |
|
|
| 401 / 403 from the API |
|
|
| 404 from the API |
|
|
| 429 from the API |
|
|
| 5xx from the API |
|
|
| Network / transport failure |
|
|
| Malformed input or response (400 / 422) |
|
|
| Local filesystem failure |
|
|
| Other non-2xx |
|
|
| Unexpected internal error |
|
|
The full table is also embedded in stratos schema's error_types field, so an agent can pull both the verb surface and the error contract in one introspection roundtrip.
Examples
Bash idioms below assume GNU / BSD xargs. Full source for each lives in examples/.
Daily smoke test against production:
stratos health --deep | jq '.bindings | to_entries[] | select(.value != true)'
# (no output = all bindings healthy)CI cache invalidation after a deploy:
export CLOUDCDN_ACCOUNT_KEY="$CLOUDCDN_PROD_KEY"
stratos purge --tag "build-${GITHUB_SHA::7}" --tag "project-akande"Short-lived signed URL for a client preview:
EXPIRES=$(($(date +%s) + 600)) # 10 minutes
stratos signed "/clients/$CLIENT/preview.pdf" --expires "$EXPIRES"Tail live edge logs (Ctrl-C clean):
stratos logs tail --level errorRecursive site upload with concurrency:
stratos storage sync ./dist /sites/acme --concurrency 16Batch AI alt-text generation (one curl per asset, 4 in parallel, NDJSON-streamed):
stratos assets --format=jpg --output ndjson | jq -r '.Path' \
| xargs -I{} -P4 stratos ai alt "https://cloudcdn.pro{}"Detect edge-config drift in CI (exits non-zero on diff):
stratos rules diff _headers -f ./public/_headersAgent-friendly retry from a typed error:
# An agent caller wraps each call with this pattern.
if ! out=$(stratos purge --tag "$TAG" --json 2>err.json); then
retryable=$(jq -r '.error.retryable' err.json)
[[ "$retryable" == "true" ]] && sleep 1 && retry
fiRecipe | File |
CI cache bust + warm-up | |
Client preview signed URL | |
Batch AI alt-text → CSV | |
Log triage → Slack webhook | |
MCP with Claude Code | |
Migrating from Wrangler | |
Migrating from Fastly CLI | |
Migrating from Codex CLI | |
Setting up the Homebrew tap |
When not to use Stratos
Stratos is shaped for a specific bet. It's the wrong tool when:
You need local emulation.
wrangler devandfastly devship dev servers; Stratos is API-only today (Phase 2 of the implementation plan addsstratos dev). For local CloudCDN now, run the upstream stack and pointCLOUDCDN_URLat it.You need a richer SDK with auto-pagination iterators, typed response models, or built-in observability hooks. Use the upstream HTTP API directly with your preferred client.
You're on Node < 20. Stratos uses
AbortSignal.timeout, the stable globalfetch, andcrypto.subtle. We won't backport.You need browser support. Stratos is Node-only — it shells out (
security,secret-tool), readsprocess.env, callsprocess.exit. None of that runs in a browser.You need Wrangler/Fastly-specific primitives (D1, KV, Compute@Edge, VCL). Different platforms. See
NON-GOALS.mdfor the full list of deliberate scope exclusions.You can't tolerate breaking changes during 0.0.x. Per versioning policy, all
0.0.xreleases may include breaking changes. We will not bump to0.1.0until0.0.999.
Integrity & supply chain
Pinned SHA-256. Both shell installers verify the downloaded
stratos.mjsagainst a SHA-256 constant baked into the installer itself.npm provenance. Releases publish with
npm publish --provenance— Sigstore-backed attestation. Verify with:npm audit signaturesSLSA L3 build provenance. Each tagged release attaches an in-toto attestation (
stratos-v<version>.intoto.jsonl) viaslsa-framework/slsa-github-generator. Verify withslsa-verifier. Standard GitHub Actions attestations also exist:gh attestation verify stratos.mjs --owner sebastienrousseauCosign keyless signatures.
.sigand.crtfiles alongside every canonical artefact (script, binaries, installers, SBOM, VEX). Sigstore Fulcio CA + Rekor transparency log. SeeSECURITY-AUDIT.mdfor the verification recipe.CycloneDX SBOM + VEX. Attached to every release; both signed with Cosign keyless.
Signed commits. Every commit on
mainis SSH ED25519 signed.No telemetry. Every network call is initiated by an explicit command. No phone-home, no auto-update polling.
Offline
signed. The HMAC mint runs in-process; the secret never leaves the host.
Manual verification:
curl -fsSL https://cloudcdn.pro/dist/stratos/stratos.mjs -o stratos.mjs
shasum -a 256 stratos.mjs
# Compare against EXPECTED_SHA in install/install.shDevelopment
Stratos is a single ES module with no runtime dependencies. The only dev-only dependency is c8 (coverage aggregation).
.
├── stratos.mjs # the CLI (~4,000 lines, zero runtime deps)
├── install/
│ ├── install.sh # POSIX installer
│ └── install.ps1 # Windows installer
├── scripts/
│ ├── check-docs.mjs # zero-dep JSDoc coverage gate
│ ├── check-versions.mjs # version-string + EXPECTED_SHA agreement check
│ └── lint-tests.mjs # resource-leak rule for test/*.test.mjs
├── test/ # 532 tests across 29 files, node --test
│ ├── parse.test.mjs · router.test.mjs · signed.test.mjs · http.test.mjs
│ ├── mcp.test.mjs # JSON-RPC stdio
│ ├── commands.test.mjs · coverage-edge.test.mjs · branches.test.mjs · more-branches.test.mjs
│ ├── doctor-bench.test.mjs · diff-pagination.test.mjs
│ ├── v003.test.mjs … v013-branch-push.test.mjs # per-release regression sets
│ └── v016-{lint-tests,schema,ndjson,typed-errors}.test.mjs
├── examples/ # cookbook + migration guides
├── actions/stratos/ # composite GitHub Action
├── .github/workflows/
│ ├── ci.yml # Node 20/22/24 × { ubuntu, macos, windows }
│ └── release.yml # npm publish --provenance on tag
├── .github/dependabot.yml # weekly actions/npm/docker updates
├── .c8rc.json # coverage config (enforcement in coverage:check)
├── README.md · CHANGELOG.md · CONTRIBUTING.md · CODE_OF_CONDUCT.md
├── GOVERNANCE.md · MAINTAINERS.md · NON-GOALS.md
├── SECURITY.md · SECURITY-AUDIT.md · LICENSE-APACHE · LICENSE-MIT
└── package.json · package-lock.jsonRun the suite:
npm test # all 532 tests, ~8 s
npm run coverage # text + HTML + LCOV reports
npm run coverage:check # enforce 100 / 100 / 100 / 100 thresholds
npm run docs:check # enforce 100% JSDoc coverage
npm run tests:lint # resource-leak rule (CI gate)Run locally without installing:
node stratos.mjs version
node stratos.mjs health --cdn-url https://staging.cloudcdn.exampleSee CONTRIBUTING.md for the PR checklist (zero-dep ethos, JSDoc-on-every-declaration rule, test-required-for-every-command policy, resource-lifecycle rule for tests).
Versioning policy
Stratos uses small v0.0.x increments. We will not bump to v0.1.0 before v0.0.999, and not to v1.0.0 before the project has built genuine community traction. Even substantial feature work is a patch-level bump at this stage.
Tests & coverage
Metric | Result |
Tests | 532 / 532 green ( |
Code: Statements | 100% |
Code: Lines | 100% |
Code: Functions | 100% |
Code: Branches | 100% |
Docs: JSDoc declarations | 100% (118 / 118) |
The CI gate (Node 22 / Ubuntu) runs npm test → coverage:check → docs:check → tests:lint in sequence. The build fails below any threshold. Cross-platform CI runs all 532 tests on Node 20/22/24 × { Ubuntu, macOS, Windows }.
Security
See SECURITY.md for the disclosure policy, supported versions, and supply-chain notes. The deeper threat model + control catalogue lives in SECURITY-AUDIT.md. Report vulnerabilities privately through GitHub private reporting — please do not open public GitHub issues for security matters.
Governance
How decisions are made, who has commit rights, how to become a deputy, how releases are cut: GOVERNANCE.md. The current maintainer list is in MAINTAINERS.md. The flip side of the capabilities table — things Stratos deliberately doesn't do — is in NON-GOALS.md.
All participation is subject to the Contributor Covenant Code of Conduct.
Documentation
Resource | Where |
CLI reference |
|
Machine-readable schema |
|
Programmatic API | Programmatic API section above; full JSDoc on every export |
Cookbook | |
Migration guides |
|
MCP integration | |
Release notes | |
Security disclosure | |
Security audit / threat model | |
Contributing | |
Code of Conduct | |
Governance | |
Maintainers | |
Non-goals |
Contributions welcome.
License
Licensed under either of the Apache License, Version 2.0 or the MIT license, at your option.
See CHANGELOG.md for release history.
Available Tools
12 toolscloudcdn_ai_altWrite alt text for an imageARead-only
Generate alt text for one image with CloudCDN's vision model, for accessibility or SEO. To check whether an image is safe to publish use cloudcdn_ai_moderate instead; to find images use cloudcdn_assets or cloudcdn_search. Calls GET /api/ai/alt-text and returns its JSON: url (the path sent), alt (the suggested text), model (the vision model), source ("ai" when generated now, "cached" when served from the API's cache), degraded (true for a cached answer) and dateGenerated (ISO 8601). Changes nothing in the catalogue, but the API caches the text per path for 24 hours, so a repeat call returns the same text. Fails: an absolute http(s) URL, or a path containing "..", is rejected (HTTP 400, exit code 69); an image the API cannot fetch, HTTP 404 (exit code 69); the vision model unavailable or its daily budget used up, HTTP 503 (exit code 75 after retries); no valid key, HTTP 401 (exit code 77).
Inputs: url (required).
cloudcdn_ai_moderateClassify an image for safetyARead-onlyIdempotent
Classify one image for unsafe content before publishing it. To describe an image instead use cloudcdn_ai_alt; to find images use cloudcdn_assets or cloudcdn_search. Calls GET /api/ai/moderate and returns its JSON: url (the path sent), safe (true only when verdict is "safe"), verdict ("safe", "borderline" or "unsafe"), categories (a score from 0 to 1 for each of nudity, violence, drugs, hateSymbols and gore), reasoning (one sentence from the model), model, source ("ai" or "cached"), degraded (true for a cached answer) and dateGenerated (ISO 8601). When the model's answer cannot be parsed, verdict is "borderline" with every score 0. Deciding what to block is left to the caller; nothing is removed, and the API caches the verdict per path for 24 hours. Fails: an absolute http(s) URL, or a path containing "..", is rejected (HTTP 400, exit code 69); an image the API cannot fetch, HTTP 404 (exit code 69); the vision model unavailable, HTTP 503 (exit code 75 after retries); no valid key, HTTP 401 (exit code 77).
Inputs: url (required).
cloudcdn_assetsList catalogue assetsARead-onlyIdempotent
List the files stored on CloudCDN, one page at a time, filtered by project and file format: use it to enumerate or audit what exists, for example every webp in one project. To find files by what they show or by a word in their name use cloudcdn_search instead; for the most requested files use cloudcdn_insights_top. Calls GET /api/assets and returns a JSON array of that page's files, sorted by name, each with name (file name), path (relative to the CDN root, e.g. "acme/v1/hero.webp"), project, category, format (file extension) and size (bytes). The API puts 50 files on a page; ask for page 2, 3, ... until the array is empty. If the API answers without a Data list, its JSON is returned unchanged. Read-only. Sends CLOUDCDN_ACCESS_KEY, or else CLOUDCDN_ACCOUNT_KEY; without a valid key the API answers 401 (exit code 77). HTTP 429 or 5xx fail with exit code 75 after retries, other 4xx with exit code 69.
Inputs: page, format, project.
cloudcdn_carbonEstimate energy and CO2eARead-onlyIdempotent
Estimate the energy (kWh) and emissions (grams CO2e) of CloudCDN traffic over the last N days, per region and in total, for sustainability reporting or as a carbon-aware deploy gate. For money use cloudcdn_cost, which reads the same usage: GET /api/billing/usage when the API has it (cloudcdn.pro answers 404 today), otherwise the account totals of GET /api/core/statistics as a single region named "global", with no split by region. Energy is computed locally at 0.0000001 kWh per request plus 0.0002 kWh per GB; grid intensity is a built-in average per region (400 g/kWh for a region it does not know), or the live value from api.electricitymap.org when the API tags a region with an electricity_maps_zone. Returns JSON: days; regions, each with region, requests, bandwidth_gb, compute_kwh, transfer_kwh, total_kwh, intensity_g_per_kwh, intensity_source ("static" or "electricity_maps") and co2e_g; and totals (total_kwh, total_co2e_g). With intensity-below set it also returns threshold and cleanest (the lowest regional intensity), and unless cleanest is below threshold the call fails with exit code 69, still carrying the report. Read-only. Fails: no CLOUDCDN_ACCOUNT_KEY, a JSON-RPC error; days outside 1..30, exit code 64; statistics without request and bandwidth totals, exit code 69, instead of reporting zero usage.
Inputs: days, region, intensity-below.
cloudcdn_costBreak down spend by regionARead-onlyIdempotent
Estimate what CloudCDN traffic cost over the last N days, per region and in total, for FinOps questions. For energy and emissions use cloudcdn_carbon, which reads the same usage; for traffic without prices use cloudcdn_insights_summary. Asks GET /api/billing/usage for per-region requests and bytes first; cloudcdn.pro has no such endpoint today and answers 404, so the usage normally comes from the account totals of GET /api/core/statistics (Summary.TotalRequests and Summary.TotalBandwidth) as a single region named "global", with no split by region; projected=true skips the billing call. With zone set, the statistics narrow only the request count to that zone, and bandwidth stays account-wide. Prices are always computed locally from the published rate card, $0.20 per million requests plus $0.05 per GB. Returns JSON: days, mode ("actual" from billing usage, "projected" from statistics), regions (each with region, requests, bandwidth_gb and cost_usd, rounded to cents) and total_usd. When the billing call is not answered with 2xx, a line naming its HTTP status follows the JSON. Read-only. Fails: no CLOUDCDN_ACCOUNT_KEY, a JSON-RPC error; days outside 1..30, exit code 64; statistics without those totals, exit code 69, instead of reporting zero usage.
Inputs: days, zone, projected.
cloudcdn_healthCheck CloudCDN healthARead-onlyIdempotent
Check whether the CloudCDN API is up before acting on it, or after another tool such as cloudcdn_purge or cloudcdn_search fails, to tell an outage from a bad request. Calls GET /api/health (with ?deep=1 when deep is true) and returns its JSON: status ("ok", or "degraded" when a required binding is down), timestamp (ISO 8601), apiVersion, bindings (each backing binding's name mapped to true when it is configured), and checks, a list of probes with name, configured, healthy, method and, for bindings the API can run without, optional. Without deep each probe only checks that the binding exists (method "shape"); with deep the assets and KV probes make real reads and add latencyMs, and error when they fail, which is slower. Read-only, stores nothing, safe to repeat, needs no key. A degraded API answers HTTP 503: the request is retried (3 times by default), then the call fails as a tool error carrying the same body and exit code 75. A network failure after the retries is a JSON-RPC error.
Inputs: deep.
cloudcdn_insights_summarySummarise trafficARead-onlyIdempotent
Get one set of CloudCDN traffic totals over the last N days: use it for a usage overview, or to see whether a change moved the cache hit rate. For the busiest individual files use cloudcdn_insights_top, for spend cloudcdn_cost, for energy and emissions cloudcdn_carbon, and for individual log lines cloudcdn_logs_query. Calls GET /api/insights/summary and returns its JSON: Period ({Days, Zone}, Zone "all" when not filtered), TotalRequests, TotalBandwidth (human-readable, e.g. "1.2 GB"), TotalBandwidthBytes, CacheHitRate (a percentage string such as "93.4%", or "N/A" without cache data), UniqueCountries and DateFetched (ISO 8601). With zone set, only TotalRequests is narrowed to that zone's paths; the other figures stay account-wide. Read-only. days outside 1..90 fails with exit code 64 before any request. Sends CLOUDCDN_ACCESS_KEY, or else CLOUDCDN_ACCOUNT_KEY; without a valid key the API answers 401 (exit code 77).
Inputs: days, zone.
cloudcdn_insights_topRank the most requested assetsARead-onlyIdempotent
Rank the files that received the most requests over the last N days, busiest first: use it to find what to optimise, cache longer, or purge with cloudcdn_purge after a release. For totals across all files use cloudcdn_insights_summary; to list files regardless of traffic use cloudcdn_assets. Calls GET /api/insights/top-assets and returns the response's Assets list as a JSON array, each entry with Path (with a leading slash, e.g. "/acme/v1/hero.webp") and Requests (the request count over the window); the API reports no bytes per file. A response without an Assets list gives an empty array. Read-only. days outside 1..90 fails with exit code 64 before any request. Sends CLOUDCDN_ACCESS_KEY, or else CLOUDCDN_ACCOUNT_KEY; without a valid key the API answers 401 (exit code 77).
Inputs: days, limit.
cloudcdn_logs_queryQuery edge logsARead-onlyIdempotent
Read past CloudCDN API log entries to investigate errors or a traffic spike. For counts rather than entries use cloudcdn_insights_summary; to check whether the API is up now use cloudcdn_health. Calls GET /api/logs with CLOUDCDN_ACCOUNT_KEY and returns the response's Entries list as a JSON array, newest first, each entry with timestamp (ISO 8601), level ("error", "warn" or "info"), code (the event code) and message, plus any context fields it was logged with; a response without an Entries list gives an empty array. Read-only. Fails: no CLOUDCDN_ACCOUNT_KEY, a JSON-RPC error; a wrong key, HTTP 401 (exit code 77); HTTP 429 or 5xx, exit code 75 after retries.
Inputs: days, level, limit.
cloudcdn_purgePurge the CDN cacheADestructiveIdempotent
Remove cached copies from the CloudCDN edge so the next request fetches the file from origin; the stored file itself is not deleted. Use it after replacing a file at the same path. To find what to purge use cloudcdn_assets or cloudcdn_insights_top; if the API seems down, check cloudcdn_health first. Give one target: urls, tags, or everything=true for the whole zone; if several are given, everything wins over tags and tags over urls. Calls POST /api/purge with CLOUDCDN_ACCOUNT_KEY and returns its JSON: success (boolean), purged (the urls or tags sent, or "everything"), remaining_today (purges left of the daily allowance) and cloudflare (the upstream purge API's raw response). Cannot be undone, and a full purge sends every request to origin until the cache refills, so prefer urls or tags. Fails: no target, exit code 64; no CLOUDCDN_ACCOUNT_KEY, a JSON-RPC error; the API rejects an empty list, more than 30 URLs or tags, URLs outside https://cloudcdn.pro/ and tags other than letters, digits and hyphens (HTTP 400, exit code 69), a wrong key (HTTP 401, exit code 77), and more than 100 purges a day (HTTP 429, exit code 75).
Inputs: tags, urls, everything.
cloudcdn_searchSearch assetsARead-onlyIdempotent
Find files by meaning or by words in their name, ranked by relevance, e.g. q="dark logo" or q="pricing hero": use it when you know what you want but not where it is. To list everything in a project or format use cloudcdn_assets; to describe a hit use cloudcdn_ai_alt. Calls GET /api/search, which tries vector similarity first and falls back to fuzzy matching on names and paths, and returns a JSON array of hits, best first, each with name, path, project, category, format, size (bytes) and score (higher is closer). The API returns 20 hits by default and at most 50. Read-only. An empty q fails with exit code 64 before any request; more than 100 searches a minute (HTTP 429) or a server error fails with exit code 75 after retries.
Inputs: q (required), limit.
cloudcdn_signedMint a signed URLARead-onlyIdempotent
Create a time-limited link to a private file, to share it without making it public. Runs offline: it computes an HMAC-SHA256 signature locally, makes no network call and stores nothing, so it works when the API is down; find the path with cloudcdn_assets or cloudcdn_search, and check the API with cloudcdn_health. Returns one line of text, not JSON: <CLOUDCDN_URL>/api/signed?path=...&expires=...&sig=..., where path is the URL-encoded file path, expires the expiry as given, and sig the 64-character lowercase hex HMAC of ":", the message GET /api/signed checks with the same secret. expires is an absolute Unix time in seconds (e.g. now + 3600 for one hour), not a duration, and is not compared with the clock here: a past value gives a link the API answers with 403 "URL expired". The API also answers 403 to a path that does not start with "/" or that contains "..", "//" or a NUL byte. The secret comes from secret, else SIGNED_URL_SECRET from the environment, the stratos profile or the OS keychain. Fails: no path or expires, exit code 64; no secret, exit code 78.
Inputs: path (required), expires (required), secret.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose, and the descriptions explicitly cross-reference related tools to resolve potential overlap. Asset listing, semantic search, and top-traffic ranking are separated, as are traffic summary, cost, carbon, and logs.
All tool names use the same cloudcdn_ prefix and lowercase snake_case convention throughout. Although some names are nouns and others are actions, the pattern is highly predictable and no mixed naming styles appear.
Twelve tools is well within the appropriate range for a CloudCDN operational surface. Each tool covers a distinct concern such as health, purge, search, analytics, AI, signing, logs, cost, and carbon, so none feels redundant.
The set covers inspection, search, purge, analytics, AI enrichment, signed URLs, logs, cost, and carbon very broadly. The main gap is asset lifecycle management: there is no upload, update, delete, or cache-configuration tool, but core operational workflows are still supported.
Maintenance
Related MCP Connectors
MCP server for Statsig API - interact with Statsig's feature flags, experiments, and analytics
Unified 15-tool SEO, SERP, clean Markdown & GEO (LLM citation Share-of-Voice) MCP server.
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that wraps the Gemini CLI to provide tools for executing prompts, managing chat sessions, and accessing CLI extensions. It supports both local stdio and remote SSE transports for flexible integration with MCP clients.1-
- AlicenseAqualityCmaintenanceMCP server for Adobe Edge Delivery Services (AEM EDS). 20 tools for preview, publish, bulk operations, content reading, Core Web Vitals, 404 tracking, A/B experiments, and site configuration. Works with Claude Code, Cursor, and VS Code Copilot.4177 npm4Apache 2.0
- FlicenseNot gradedqualityCmaintenanceMulti-cloud MCP server that exposes cloud AI models as tools for AI CLI agents, supporting streaming, conversation history, parallel multi-model queries, and dynamic model discovery.3-
- FlicenseNot gradedqualityDmaintenanceLocal MCP server that exposes fixed tools for GPT, Claude, and Gemini while routing to any OpenAI-compatible chat completions backend with independent configuration per target.1-