Skip to content
mcms-cli is an unofficial community CLI(microCMS非公式).GitHub
mcms-cli Docs
English
Esc
navigateopen⌘Jpreview
On this page

Installation and authentication

Install mcms-cli and connect it to microCMS with environment variables or named profiles, then verify the active service before running commands.

Requirements

  • Node.js 20 or later
  • a microCMS service to operate
  • an API key with the permissions needed for your task

Install mcms-cli

Install the package globally when you want the command to stay available on your machine.

npm install -g @mrmtsu/mcms-cli
microcms --help

To try it without a global install, use npx.

npx @mrmtsu/mcms-cli --help

Use environment variables in CI

For CI and other non-interactive environments, provide the service domain and API key as environment variables.

export MICROCMS_SERVICE_DOMAIN=<service-domain>
export MICROCMS_API_KEY=<api-key>

microcms auth status --json
microcms config doctor --json

Avoid putting an API key directly in a command argument because it may remain in shell history or appear in the process list. Use environment variables, standard input, or the operating system keychain.

Use a named profile

Named profiles make it easier to switch between microCMS services.

microcms auth profile add staging \
  --service-domain <service-domain> \
  --set-default \
  --json

printf '%s' '<api-key>' | \
  microcms auth login \
  --profile staging \
  --api-key-stdin \
  --json

profile add stores the service domain. Store the API key separately with auth login, which writes it to the operating system keychain.

You can also choose a profile through an environment variable.

export MICROCMS_PROFILE=staging
microcms auth status --json

Verify the resolved configuration

Before a write, run both checks below. They show the selected profile, service domain, and credential source without printing the API key itself.

microcms auth status --json
microcms config doctor --json

Last updated on August 2, 2026