CLI
Overview

CLI

The MD Editor CLI (mdedit-cli) lets you manage workspaces, folders, articles, and API keys from your terminal. It is ideal for automation, CI/CD pipelines, and power users who prefer the command line.

Install

npm install -g mdedit-cli
mdedit --version

Authentication

Get an API key

Generate an API key from your account settings or via the docs:

Log in

mdedit config login --api-key <YOUR_KEY>

Credentials are stored in ~/.mdedit-cli/config.json and reused for all subsequent commands.

Log out

mdedit config logout

Quickstart

# Check who you are and which workspace is active
mdedit info
 
# List workspaces
mdedit workspace list
 
# Switch to a workspace
mdedit config use-workspace <workspaceId>
 
# List articles
mdedit article list
 
# Export an article as a ZIP file
mdedit article export <articleId> --output ./article.zip

Global flags

These flags can be appended to any command:

FlagDescription
--api-key <key>Override the API key for this invocation
--api-url <url>Override the API base URL (default: https://apiv2.mdedit.ai)
--workspace <id>Override the active workspace for this invocation
--format <plain|table|json>Control output format (default: table, unless overridden by config/env). Use json for scripting / raw output.
--localPoint to local API at http://localhost:8080
--debugPrint stack traces and request debug info on errors

Commands

config

Manage local CLI configuration stored in ~/.mdedit-cli/config.json.

mdedit config show                          # Print current config
mdedit config set <key> <value>             # Set a config key
mdedit config login --api-key <key>         # Save credentials
mdedit config logout                        # Remove saved credentials
mdedit config use-workspace <workspaceId>   # Set the active workspace
mdedit config local                         # Switch to local API
mdedit config clear                         # Reset config to defaults

api-key / apikey

Create and manage API keys for your account.

mdedit apikey list               # List all API keys
mdedit apikey create             # Create a new API key (interactive)
mdedit apikey revoke <keyId>     # Permanently revoke an API key

workspace

mdedit workspace list                         # List all workspaces
mdedit workspace list --full                  # Full/raw output (human formats)
mdedit workspace get <workspaceId>            # Get details for a workspace
mdedit workspace get <workspaceId> --full     # Full/raw output (human formats)
mdedit workspace create                       # Create a new workspace (interactive)
mdedit workspace update <workspaceId>         # Update workspace metadata
mdedit workspace delete <workspaceId>         # Delete a workspace

folder

mdedit folder list                   # List folders in the active workspace
mdedit folder list --full            # Full/raw output (human formats)
mdedit folder list --include-deleted # Include deleted folders
mdedit folder get <folderId>         # Get folder details
mdedit folder get <folderId> --full  # Full/raw output (human formats)
mdedit folder create                 # Create a folder (interactive)
mdedit folder update <folderId>      # Update folder metadata
mdedit folder delete <folderId>      # Delete a folder

article

mdedit article list                    # List articles in the active workspace
mdedit article list --full             # Full/raw output (human formats)
mdedit article list --folder <folderId>          # List articles in a folder
mdedit article get <articleId>         # Get article details and metadata
mdedit article get <articleId> --content-only      # Print only markdown content (stdout)
mdedit article get <articleId> --include-content   # Include markdown content in the output object
mdedit article get <articleId> --full              # Full/raw output (human formats)
mdedit article create                  # Create an article (interactive)
mdedit article update <articleId>      # Update article metadata
mdedit article delete <articleId>      # Delete an article
mdedit article export <articleId>      # Export article as a ZIP file

Utilities

mdedit health    # Check API health / connectivity
mdedit info      # Print CLI + API connectivity summary

CI/CD usage

Use --format json to get machine-readable output suitable for scripts and pipelines:

# List articles as JSON and pipe into jq
mdedit article list --format json | jq '.[].articleId'
 
# Export an article as a ZIP
mdedit article export <articleId> --output ./article.zip

You can supply --api-key and --workspace as environment variables or flags to avoid storing credentials in CI secrets files.

Configuration file

The config file lives at ~/.mdedit-cli/config.json and contains:

{
  "apiKey": "...",
  "apiUrl": "https://apiv2.mdedit.ai",
  "workspaceId": "..."
}

All keys can be overridden at invocation time with the corresponding global flag.

Agent / AI tool integration

The CLI is built to be used by AI agents (Claude Code, Cursor, GitHub Copilot, Codex, etc.) without modification.

Agent tips

  • Use --format json for machine-readable output. In json mode all human-facing messages are routed to stderr, keeping stdout clean for parsing.
  • Pass all required flags on the command line to avoid interactive prompts.
  • Use --yes / -y on destructive commands to skip confirmation.
  • Pipe markdown content via --file - (stdin) or read it back with --content-only (stdout).

skill

The CLI ships with a built-in skill document — a compact, agent-optimised reference that covers every command, flag, and common workflow.

# Print the skill to stdout (pipe to your agent's context)
mdedit skill show
 
# Install into all detected agent config files (project-local)
mdedit skill install
 
# Install for a specific tool only
mdedit skill install --target claude    # → CLAUDE.md
mdedit skill install --target cursor    # → .cursor/rules/mdedit.mdc
mdedit skill install --target codex     # → .github/copilot-instructions.md
 
# Install to home-directory (global) targets instead of project directory
mdedit skill install --global

OpenClaw plugin

An openclaw.json plugin manifest is bundled with the npm package. It describes every CLI tool as a structured entry that OpenClaw-compatible agents can load directly.

# Find the manifest path after installing globally
node -e "console.log(require.resolve('mdedit-cli/openclaw.json'))"