CLI reference

Complete reference for all mog CLI commands, flags, and exit codes.

The mog CLI is available as an npm package. All commands support --json for machine-readable output, making the CLI suitable for use inside agent runners and CI pipelines.

npm install -g mogmd

Exit codes

CodeMeaning
0Success
1Error (printed to stderr)
2Approval required — an approvalUrl is included in the JSON output

JSON output

Add --json to any command to get structured output. All JSON responses share this envelope:

// Success
{ "ok": true, "command": "install", "data": { ... } }
 
// Error
{ "ok": false, "command": "install", "error": "Package not found" }
 
// Approval required (exit code 2)
{ "ok": false, "command": "buy", "error": "Approval required", "approvalUrl": "https://mog.md/..." }

The data field shape varies per command — see each command below for its specific output shape.

Global options

FlagDescription
--versionPrint CLI version and exit
--helpPrint help for a command

mog init

Initialize a mog project in the current directory. Creates a lockfile and prints target-specific setup guidance.

mog init [options]
FlagDescriptionDefault
--dir <path>Project directorycurrent directory
--jsonOutput as JSON

What init does

  1. Creates an empty mog.lock.json if one doesn't exist
  2. Adds a note to .gitignore (if inside a git repo)
  3. Auto-detects the target (Cursor, Claude Code, etc.) from the project directory
  4. Prints getting-started guidance for that target

JSON output (--json)

{
  "ok": true,
  "command": "init",
  "data": {
    "target": "cursor",
    "lockfile": "/my-project/mog.lock.json",
    "created": ["mog.lock.json"]
  }
}

mog setup

One-shot onboarding: authenticate (device code by default, or optional web --token, or existing MOG_TOKEN / saved credentials), optionally install mogmd globally when you ran via npx, then run the same project initialization as mog init.

mog setup [options]
mog setup --token "mog_setup_…"   # optional shortcut from mog.md Install CLI
FlagDescriptionDefault
--token <token>One-time token from the Install CLI dialog (skips device login)
--dir <path>Project directorycurrent directory
--no-globalSkip global install when using npx
--jsonOutput as JSON (non-interactive: requires MOG_TOKEN or valid saved session)

Examples

npx mogmd@latest setup
npx mogmd@latest setup --token "mog_setup_…"
MOG_TOKEN= npx mogmd@latest setup --json
mog setup --token "mog_setup_…" --no-global

mog auth

Authenticate with the mog marketplace using the device code flow (RFC 8628).

mog auth [options]
FlagDescription
--logoutLog out and remove stored credentials
--statusShow current auth status without triggering login
--forceRe-authenticate even if already signed in
--jsonOutput as JSON

How it works

Running mog auth starts the device flow: it requests a short code from the API, prints a URL and code, and polls until you approve in a browser. Once approved, the token is stored locally. This flow works in fully headless environments — no browser is needed on the CLI host.

Examples

# Start authentication
mog auth
 
# Check if authenticated
mog auth --status
 
# Log out
mog auth --logout

Credential storage

  • macOS / Linux: ~/.config/mog/credentials.json
  • Windows: %USERPROFILE%\.config\mog\credentials.json

JSON output (--json)

{ "ok": true, "command": "auth", "data": { "authenticated": true } }
{ "ok": true, "command": "auth", "data": { "loggedOut": true } }
{ "ok": true, "command": "auth", "data": { "authenticated": false } }

Search the mog marketplace for packages.

mog search [query] [options]
FlagDescriptionDefault
[query]Full-text search query (optional)
--type <type>Filter by type: skill, rule, bundle, template, mcp
--target <target>Filter by agent target: cursor, claude-code, codex, gemini-cli, windsurf, generic
--sort <sort>Sort order: popular, recent, rated, price_asc, price_descpopular
--freeShow only free packages
--page <n>Page number1
--jsonOutput as JSON

Examples

# Free-text search
mog search "react testing"
 
# Only skills for Cursor
mog search --target cursor --type skill
 
# Free packages sorted by newest
mog search --free --sort recent
 
# JSON output for scripting
mog search "testing" --json

JSON output (--json)

{
  "ok": true,
  "command": "search",
  "data": {
    "results": [
      {
        "id": "uuid",
        "vendorSlug": "acme",
        "slug": "react-testing-skill",
        "title": "React Testing Skill",
        "description": "...",
        "type": "skill",
        "targets": ["cursor", "claude-code"],
        "priceCents": 0,
        "currency": "usd",
        "latestVersion": "1.2.0",
        "installCount": 124,
        "rating": "4.8",
        "ratingCount": 12,
        "vendorName": "Acme Corp",
        "vendorVerified": true
      }
    ],
    "total": 1,
    "page": 1,
    "perPage": 20
  }
}

mog buy

Purchase a package without installing it.

mog buy <vendor/package> [options]

Requires authentication.

FlagDescription
<vendor/package>Package identifier, e.g. acme/router-eval
--max-price <cents>Maximum price in cents. If the package costs more, the purchase is blocked.
--autoAllow automatic purchase within policy limits
--jsonOutput as JSON

Approval required (exit code 2)

If the package price exceeds your spend policy or the --max-price ceiling, the command exits with code 2:

{ "ok": false, "command": "buy", "error": "Approval required", "approvalUrl": "https://mog.md/purchases/approve?listing=..." }

JSON output (--json)

// Successful purchase
{
  "ok": true,
  "command": "buy",
  "data": {
    "status": "purchased",
    "entitlementId": "uuid",
    "orderId": "uuid",
    "amountCents": 500
  }
}
 
// Already owned
{ "ok": true, "command": "buy", "data": { "status": "already_owned", "entitlementId": "uuid" } }

mog install

Download, verify, and install a package. Optionally purchase it in the same step with --auto-buy.

mog install <vendor/package> [options]

Requires authentication.

FlagDescriptionDefault
<vendor/package>Package identifier, e.g. acme/router-eval
--target <target>Installation target: cursor, claude-code, codex, gemini-cli, windsurf, generic. Auto-detected if not specified.auto
--auto-buyAutomatically purchase the package if not already owned
--max-price <cents>Maximum price in cents when using --auto-buy
--preflightShow what would happen without making any changes
--dir <path>Installation directorycurrent directory
--env <KEY=VALUE>Set an environment variable for MCP packages (repeatable)
--wireAuto-create an editor rule pointing to the installed skill
--require-signaturesFail if the package signature is missing or invalid
--jsonOutput as JSON

Target auto-detection

If --target is not specified, the CLI detects the environment by checking for marker directories in the current working directory (checked in this order):

  • .cursor/ → target: cursor
  • .claude/ → target: claude-code
  • .windsurf/ → target: windsurf
  • .gemini/ → target: gemini-cli
  • .codex/ → target: codex
  • .openclaw/ → target: openclaw
  • (none) → target: generic

Default install paths

TargetDefault install path
cursor.cursor/skills/{slug}/
claude-code.claude/skills/{slug}/
codexmog_modules/{slug}/
gemini-cli.gemini/skills/{slug}/
windsurf.windsurf/skills/{slug}/
openclawskills/{slug}/
genericmog_modules/{slug}/

Package authors can override these defaults in their mog.yaml install_map field.

Wiring skills into your editor (--wire)

After installing a skill package, your AI assistant still needs a pointer to the skill file. The --wire flag creates that pointer automatically:

# Cursor: creates .cursor/rules/{slug}.mdc pointing to the SKILL.md
mog install acme/react-testing-skill --target cursor --wire
 
# Claude Code: appends a reference to AGENTS.md
mog install acme/react-testing-skill --target claude-code --wire

Without --wire, the CLI prints a "Next steps" block showing the exact file contents to create manually.

MCP server packages

For packages with type: mcp, mog install writes the server configuration to the client's mcpServers config file instead of extracting files. Use --env KEY=VALUE to supply required environment variables non-interactively:

mog install acme/github-mcp-server \
  --env GITHUB_TOKEN=ghp_xxx \
  --target cursor
 
# Multiple env vars
mog install acme/slack-mcp \
  --env SLACK_TOKEN=xoxb-xxx \
  --env SLACK_TEAM_ID=T0123 \
  --auto-buy

After installing an MCP package, restart your IDE for the server to be discovered.

What install does

  1. Fetches the listing and resolves the latest published release
  2. Checks your entitlement; purchases if --auto-buy is set
  3. Requests a signed download URL (expires in 5 minutes)
  4. Downloads the .zip archive and verifies the SHA-256 hash
  5. Extracts files to the install path (path traversal protected)
  6. Writes the entry to mog.lock.json atomically

JSON output (--json)

{
  "ok": true,
  "command": "install",
  "data": {
    "package": "acme/router-eval",
    "version": "1.0.0",
    "target": "cursor",
    "installPath": "/my-project/.cursor/skills/router-eval/",
    "files": 3
  }
}

mog ls

List all packages installed in the current project (reads from mog.lock.json).

mog ls [options]
FlagDescriptionDefault
--dir <path>Project directory to read lockfile fromcurrent directory
--check-updatesCheck for available updates (requires network)
--jsonOutput as JSON

JSON output (--json)

{
  "ok": true,
  "command": "ls",
  "data": {
    "count": 2,
    "packages": [
      {
        "name": "acme/router-eval",
        "vendor": "acme",
        "slug": "router-eval",
        "version": "1.0.0",
        "target": "cursor",
        "installPath": "/my-project/.cursor/skills/router-eval/",
        "installedAt": "2026-01-15T10:00:00.000Z",
        "updateChannel": "minor"
      }
    ]
  }
}

mog update

Update installed packages to the latest compatible version. Respects the updateChannel field in the lockfile (default: minor — blocks major version bumps).

mog update [vendor/package] [options]

Requires authentication.

FlagDescriptionDefault
[vendor/package]Specific package to update. If omitted, updates all packages.
--dry-runShow available updates without installing anything
--channel <patch|minor|major>Override the update channel for this runlockfile value
--majorAllow major version upgrades (shorthand for --channel major)
--dir <path>Project directorycurrent directory
--jsonOutput as JSON

Update channels

ChannelAllowed updates
patchPatch versions only (e.g. 1.0.0 → 1.0.1)
minorPatch and minor versions (e.g. 1.0.0 → 1.2.0) — default
majorAll versions including major bumps

JSON output (--json)

{
  "ok": true,
  "command": "update",
  "data": {
    "updated": [{ "name": "acme/router-eval", "from": "1.0.0", "to": "1.1.0" }],
    "skipped": [{ "name": "acme/big-upgrade", "version": "2.0.0", "reason": "Major upgrade requires explicit opt-in." }]
  }
}

mog uninstall

Remove an installed package and update the lockfile.

mog uninstall <vendor/package> [options]
FlagDescriptionDefault
<vendor/package>Package identifier, e.g. acme/router-eval
--dir <path>Project directorycurrent directory
--jsonOutput as JSON

Removes the install directory from disk and deletes the entry from mog.lock.json. Does not revoke your entitlement — you can reinstall at any time.

JSON output (--json)

{
  "ok": true,
  "command": "uninstall",
  "data": {
    "package": "acme/router-eval",
    "removedPath": "/my-project/.cursor/skills/router-eval/"
  }
}

mog publish

Build, upload, scan, and publish a package from a local directory.

mog publish [options]

Requires authentication with sell scope (vendor account required).

FlagDescriptionDefault
--dir <path>Package directory to publishcurrent directory
--price <dollars>Price in USD (e.g. 4.99). Only applied on the first upload of this package.
--yesSkip confirmation prompt
--jsonOutput as JSON

What publish does

  1. Reads and validates mog.yaml in the package directory
  2. Zips the directory (excluding .git, node_modules, .DS_Store)
  3. Prompts for confirmation (unless --yes)
  4. Uploads the archive to the API
  5. Polls the scan pipeline until the scan completes (max 2 minutes)
  6. Automatically publishes the release if the scan passes

Examples

# Publish from the current directory
mog publish
 
# Publish a package directory at a specific price
mog publish --dir ./my-skill --price 4.99
 
# Skip prompts (for CI pipelines)
mog publish --yes --json

JSON output (--json)

{
  "ok": true,
  "command": "publish",
  "data": {
    "name": "acme/my-skill",
    "version": "1.0.0",
    "releaseId": "uuid",
    "listingId": "uuid"
  }
}

mog outdated

Show available updates without installing anything. Alias for mog update --dry-run.

mog outdated [vendor/package] [options]
FlagDescriptionDefault
[vendor/package]Specific package to check. If omitted, checks all.
--channel <patch|minor|major>Override update channel for this checklockfile value
--majorInclude major version upgrades in check
--dir <path>Project directorycurrent directory
--jsonOutput as JSON

JSON output (--json)

{
  "ok": true,
  "command": "update",
  "data": {
    "updated": [{ "name": "acme/router-eval", "from": "1.0.0", "to": "1.1.0" }],
    "skipped": [{ "name": "acme/big-upgrade", "version": "2.0.0", "reason": "Major upgrade requires explicit opt-in." }],
    "failed": []
  }
}

mog doctor

Check project health: installed packages, editor wiring, and configuration.

mog doctor [options]
FlagDescriptionDefault
--dir <path>Project directorycurrent directory
--jsonOutput as JSON

What doctor checks

  • Auth — whether you're authenticated
  • Lockfile — whether mog.lock.json exists
  • Target detection — which editor/tool was detected and why
  • Installed packages — lists all packages with their paths and types
  • Missing files — flags packages whose install path no longer exists
  • Wiring — for Cursor, checks that each installed skill has a matching .cursor/rules/{slug}.mdc; for Claude Code, checks that AGENTS.md exists; for OpenClaw, checks that SKILL.md exists under each openclaw install path

Exits with code 1 if any issues are found.

Example output

  mog doctor

  Auth:       ✓ authenticated
  Lockfile:   ✓ mog.lock.json
  Target:     cursor (.cursor/ directory found)
  Packages:   2

  Installed packages

  acme/react-testing-skill@1.2.0  cursor
    → .cursor/skills/react-testing-skill/

  1 issue found:

  ⚠ react-testing-skill — no .cursor/rules/react-testing-skill.mdc found. Run: mog install acme/react-testing-skill --wire

JSON output (--json)

{
  "ok": true,
  "command": "doctor",
  "data": {
    "authenticated": true,
    "lockfile": true,
    "detectedTarget": "cursor",
    "detectedReason": ".cursor/ directory found",
    "packages": [
      {
        "name": "acme/react-testing-skill",
        "version": "1.2.0",
        "target": "cursor",
        "installPath": ".cursor/skills/react-testing-skill/",
        "installType": "files"
      }
    ],
    "issues": [],
    "healthy": true
  }
}

mog explain

Show package metadata, install paths for all targets, and agent trigger text — useful for agents and scripts that need to understand a package before installing.

mog explain <vendor/package> [options]

Requires authentication.

FlagDescription
<vendor/package>Package identifier, e.g. acme/react-testing-skill
--jsonOutput as JSON

Example output

  React Testing Skill
  acme/react-testing-skill@1.2.0

  Comprehensive React testing patterns including RTL, Vitest, and MSW

  ──────────────────────────────────────
  Type:       skill
  License:    MIT
  Price:      Free
  Targets:    cursor, claude-code
  Tags:       react, testing, vitest
  URL:        https://mog.md/packages/acme/react-testing-skill

  Install paths by target

  cursor         .cursor/skills/react-testing-skill/
  claude-code    .claude/skills/react-testing-skill/

  Agent trigger
  (first paragraph of README — paste into rules/AGENTS.md)

  This skill teaches your AI assistant comprehensive React testing patterns...

  Install: mog install acme/react-testing-skill --target cursor
  Install + wire: mog install acme/react-testing-skill --target cursor --wire

JSON output (--json)

{
  "ok": true,
  "command": "explain",
  "data": {
    "name": "acme/react-testing-skill",
    "title": "React Testing Skill",
    "description": "Comprehensive React testing patterns...",
    "type": "skill",
    "license": "MIT",
    "targets": ["cursor", "claude-code"],
    "installPaths": {
      "cursor": ".cursor/skills/react-testing-skill/",
      "claude-code": ".claude/skills/react-testing-skill/"
    },
    "latestVersion": "1.2.0",
    "price": "free",
    "tags": ["react", "testing", "vitest"],
    "agentTrigger": "This skill teaches your AI assistant...",
    "url": "https://mog.md/packages/acme/react-testing-skill"
  }
}

mog org

Manage organizations. Organizations let teams share a wallet, spend policies, and private packages under a single account.

mog org <subcommand> [options]

The active org context is stored locally. When an org is active, mog buy and mog install --auto-buy use the org wallet instead of your personal wallet.

mog org list

List organizations you are a member of.

mog org list [options]
FlagDescription
--jsonOutput as JSON

mog org create

Create a new organization.

mog org create <slug> <name> [options]
Argument/FlagDescription
<slug>Org identifier — lowercase letters, numbers, hyphens, 2–39 chars
<name>Display name
--jsonOutput as JSON

mog org switch

Set the active org context. All subsequent purchases use the org wallet.

mog org switch <slug> [options]

Pass none or - to clear the org context and revert to your personal wallet.

FlagDescription
--jsonOutput as JSON

mog org whoami

Show the currently active org context.

mog org whoami [options]
FlagDescription
--jsonOutput as JSON

mog org invite

Invite a user to the current active org by email.

mog org invite <email> [options]

Requires admin role in the org.

FlagDescriptionDefault
--role <admin|member>Role to assignmember
--org <slug>Org slug (overrides active context)active org
--jsonOutput as JSON

mog org wallet

Show the active org's wallet balance and auto top-up settings.

mog org wallet [options]
FlagDescriptionDefault
--org <slug>Org slug (overrides active context)active org
--jsonOutput as JSON

mog keys

Manage Ed25519 package signing keys. When a signing key is registered, mog publish automatically signs every uploaded archive. Buyers can verify your packages have not been tampered with.

mog keys <subcommand> [options]

Requires a vendor account.

mog keys generate

Generate a new Ed25519 signing keypair and save it locally.

mog keys generate [options]
FlagDescription
--forceOverwrite an existing key
--jsonOutput as JSON

Key files are stored at:

  • ~/Library/Application Support/mog/signing-key.pem (private, mode 0600)
  • ~/Library/Application Support/mog/signing-key.pub.pem (public)

After generating, run mog keys register to activate the key.

mog keys register

Upload your public key to mog.md. Once registered, all future mog publish uploads are automatically signed.

mog keys register [options]
FlagDescription
--jsonOutput as JSON

mog keys list

List your registered signing keys and key history.

mog keys list [options]
FlagDescription
--jsonOutput as JSON

mog keys revoke

Revoke your current active signing key. Future uploads will not require signatures until a new key is registered.

mog keys revoke [options]
FlagDescription
--jsonOutput as JSON

Environment variables

VariableDescriptionDefault
MOG_API_URLOverride the API base URL (useful for self-hosting or development)https://api.mog.md
MOG_TOKENAPI token. Read before checking the credentials file.