Official Directus CLI for bootstrapping self-hosted projects, migrating the database, and snapshotting or applying schema.
$npm init directus-project <project-folder>
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
Directus CLI is the server-side command surface for setting up and operating a self-hosted Directus project. It focuses on project bootstrap, database lifecycle, schema promotion, and a small set of admin tasks against the instance database.
What It Enables
- Create or bootstrap a self-hosted Directus project, install or migrate the database, and start the API.
- Snapshot a Directus schema to YAML or JSON, preview changes with
--dry-run, and apply schema updates between environments. - Create roles and users, reset user passwords, and run simple maintenance checks such as collection counts against the project database.
Agent Fit
schema snapshot --format json,schema apply --dry-run, and--yessupport make schema promotion and verification workable in scripts or CI.- The surface is mixed rather than broad: most commands assume a local project directory, configured database environment, or human prompts, especially
init. - Directus itself can expose an
/mcpendpoint when the server is running, but this package is mainly a deployment and schema-management CLI, not the richer client-sidedirectusctlautomation surface.
Caveats
- Most day-to-day content reads and writes happen through the Directus REST or GraphQL APIs, or the separate
directusctlCLI, rather than this server-side package. - Useful operation requires a configured project and database connection, and
initinstalls drivers and prompts for database and admin details.