Set up MDCMS automatically — paste this into Claude Code, Codex, or any AI coding agent
Install
mdcms command directly:
mdcms. If installed as a project dependency, use your package manager’s runner:
Prerequisites
- Node.js 20+ or Bun 1.3.11+
- A running MDCMS server instance
First-time setup
Themdcms init command walks you through an interactive wizard that configures everything needed to start managing content.
Enter server URL
Provide the URL of your MDCMS server (e.g.
https://cms.example.com). The CLI
validates the connection with a health check before proceeding.Choose project and environment
Select an existing project or create a new one, then choose the target
environment (e.g.
development, staging, production).Authenticate via browser
The CLI opens your default browser for OAuth authentication using a device
flow. Complete the login in your browser and the CLI receives credentials
automatically.
Auto-detect content directories and locales
The wizard scans your repository for Markdown and MDX files, groups them by
directory, and detects locale patterns from file names (e.g.
post.en.mdx,
post.fr.mdx).Generate mdcms.config.ts
A configuration file is generated at the project root with your project
settings, content type definitions inferred from existing files, and locale
configuration.
Initial schema sync and content push
The inferred schema is synced to the server, and all discovered content files
are pushed as initial draft documents.
Global options
Every command accepts these flags:| Flag | Description |
|---|---|
--project <slug> | Override the target project slug |
--environment <name> | Override the target environment name |
--api-key <token> | Provide an API key directly (useful for CI) |
--server-url <url> | Override the server URL from config |
--config <path> | Path to config file (default: mdcms.config.ts) |
-V, --version | Print installed CLI version and exit |
-h, --help | Show help text |
Resolution order
When the CLI needs a value for project, environment, server URL, or API key, it resolves from the highest-priority source first:- CLI flags —
--project,--environment,--api-key,--server-url - Environment variables —
MDCMS_PROJECT,MDCMS_ENVIRONMENT,MDCMS_API_KEY,MDCMS_SERVER_URL - Config file — values from
mdcms.config.ts - Stored credentials — API key from the local credential store (set by
mdcms login)
CLI flags always win. This makes it straightforward to override config values
in CI pipelines or when working across multiple environments.