Config file
The CLI reads its configuration frommdcms.config.ts at the project root. Use defineConfig and defineType from @mdcms/cli to get full type safety.
mdcms.config.ts
Config options
All properties accepted bydefineConfig:
| Property | Type | Required | Description |
|---|---|---|---|
project | string | Yes | Project slug. Must match the project on the server |
serverUrl | string | Yes | Base URL of the MDCMS server |
environment | string | No | Default environment name (e.g. development) |
contentDirectories | string[] | No | Directories to scan for content files. Default: ["content"] |
locales | object | No | Locale configuration (see below) |
types | MdcmsTypeDefinition[] | No | Content type definitions created with defineType |
environments | Record<string, object> | No | Per-environment config overlays (can override serverUrl, environment) |
components | object[] | No | MDX component registrations for the Studio editor |
Locale options
| Property | Type | Description |
|---|---|---|
locales.default | string | The default locale code (e.g. "en") |
locales.supported | string[] | All supported locale codes |
locales.aliases | Record<string, string> | Map alternate locale codes to canonical ones |
Type definition options
EachdefineType(name, options) accepts:
| Property | Type | Description |
|---|---|---|
directory | string | Filesystem directory for this type’s content files |
localized | boolean | Whether documents of this type are localized. Default: false |
fields | Record<string, ZodSchema> | Frontmatter field definitions using Zod schemas |
Manifest file
The manifest tracks the mapping between server documents and local files. It is stored at.mdcms.manifest.json in the project root, scoped to the current project and environment.
Structure
The manifest is a JSON object where each key is adocumentId and the value describes the local file:
.mdcms.manifest.json
| Field | Type | Description |
|---|---|---|
path | string | Relative path to the content file from project root |
format | "md" | "mdx" | File format |
draftRevision | number | Current draft revision number on the server |
publishedVersion | number | null | Published version number, or null if never published |
hash | string | Content hash of the file at last sync |
Schema state
After eachmdcms schema sync, the CLI writes a state file to:
marketing-site project in the development environment produces:
Contents
.mdcms/schema/marketing-site.development.json
schemaHash is required by mdcms push to validate that content is being pushed against the correct schema version. If this file is missing or the hash is stale, push operations will fail.
The
.mdcms/ directory should be added to .gitignore. The mdcms init
wizard does this automatically.File mapping
The CLI maps server documents to local files based on the type’sdirectory setting and the document’s path and locale.
Localized documents
Localized types produce files with the locale code inserted before the file extension:BlogPost document with path hello-world, locale en, and format mdx:
Non-localized documents
Non-localized types use a simpler pattern without the locale segment:Author document with path jane-doe and format md: