mg CLI

Put your AI agent to work across the fleet

Clicking through a console does not scale — diagnostics, alert triage, and group-wide actions live in one binary. Install the skill for Claude Code, Codex, or Gemini and your agent drives the same commands you do.

macOS · Linux · WindowsSingle static binaryEvery write action auditedFirst 200 endpoints free for the first year
zsh — mglive
QUICKSTART

From install to fleet in three commands

1mg profile create prod https://center.sirketiniz.local

Point at your Center

Create a named profile for each Center — on-prem, staging, or a customer tenant.

2mg auth login

Approve once in the browser

The token is issued through the Center approval flow and stored locally per profile.

3mg device list

See your fleet

Devices, alerts, scripts, and runs are now one command away — for you and your agent.

AGENT WORKFLOWS

Give it the hard jobs

Your agent gets the same CLI controls you use across the fleet.

agent — diagnosticslive

From one prompt to the root cause

Inspect device context and alerts, run diagnostics, and turn the output into a proposed fix.

agent — runslive

Fix the whole group at once

Target a group, wait for every result, and isolate failures before you rerun anything.

agent — skilllive

The agent teaches itself

mg skill install writes a SKILL.md that teaches Claude Code, Codex, and Gemini how to drive every command — no plugin or config needed.

COMMAND COVERAGE

Talk to the fleet from the terminal

Your agent gets the same commands, context, and control.

Auth & Profiles

  • mg auth login

    Browser approval flow; issues a token

  • mg auth status

    Shows active session + organization

  • mg auth logout

    Revokes token, clears local credentials

  • mg profile list

    Lists configured profiles

  • mg profile create <name> <url>

    Adds a new profile

  • mg profile use <name>

    Sets the default profile

  • mg profile delete <name>

    Deletes a profile (suggests logout)

Devices

  • mg device list

    Lists devices (filters: --group, --tag, --status, --os)

  • mg device inspect <id|hostname>

    Single device detail

  • mg device export

    CSV export

Alerts

  • mg alert list

    Lists alerts (--device, --severity, --status)

  • mg alert inspect <id>

    Single alert detail

  • mg alert resolve <id>

    Resolves an alert (write scope)

Scripts

  • mg script list

    Lists saved scripts

  • mg script run --command "…" --device <id>

    Runs an ad-hoc command

  • mg script run --script <name> --group <g> --wait

    Runs a saved script on a group

Runs

  • mg run list

    Lists running/completed runs

  • mg run inspect <id>

    Run detail (per-action status)

  • mg run cancel <id>

    Cancels a run

  • mg run retry <id>

    Retries failed actions

Skill Generator (BYOA)

  • mg skill show

    Prints SKILL.md to stdout

  • mg skill install

    Writes to ~/.agents/skills/moftgate/SKILL.md

  • mg skill install --project

    Writes to ./.agents/skills/moftgate/SKILL.md

  • mg skill describe <command>

    Shows single-command detail

Output Formats

  • tableDefault — human-readable, colored
  • -o jsonMachine-readable JSON output
  • --jq <filter>jq filter, e.g. --jq '.list[] | {id, name}'
  • csvCSV export (mg device export)

Global Flags

  • --profile <name>Select a profile
  • -o, --output <fmt>json | table
  • --jq <filter>jq filter (implies JSON)
  • --limit <n|all>Pagination (default 100)
  • --page <n>Page number
  • --yesNon-interactive confirmation for risky operations
  • --ca-bundle <path>Custom CA (on-prem self-signed)
  • --insecureDisables TLS verify (dev only)
BRING YOUR OWN AGENT

Humans and agents use the same CLI

Run mg directly, or through your AI agent. The token issued by mg auth login works identically in both cases; every write action lands in the Center audit log.

zsh — moftgatelive
FAQ

mg CLI — Frequently Asked Questions

mg is a single static binary for macOS, Linux, and Windows. It talks directly to your Moftgate Center over its API — no extra server or gateway required.
ENTERPRISE SECURITY & BUSINESS RESILIENCE

Bring your fleet to the terminal

mg ships with the platform — your first 200 endpoints are free.