CLI vs MCP: What To Use, When

Both interfaces are valid and both execute the same core command catalog.

  • flutter_mcp_cli: direct command-line interface for scripts, CI, snapshots, and deterministic automation.
  • flutter_inspector_mcp (MCP server): assistant-facing interface over MCP for Codex/Claude/Cursor workflows.

Recommended default: start with CLI, then layer MCP client workflows on top.

Why We Have Both

They solve different UX problems:

  • CLI is optimized for reproducible terminal automation.
  • MCP is optimized for conversational tool use inside AI clients.

Internally they share the same execution core, so behavior and command semantics stay aligned.

Quick Difference Table

TopicCLI (flutter_mcp_cli)MCP Server (flutter_inspector_mcp)
Primary userdevelopers, CI, automation scriptsAI assistants and agent chat clients
Interfaceterminal commands / JSON argsMCP tools/resources via client
Transportlocal process executionstdio MCP protocol between client and server
Best forsnapshots, diff/bundle artifacts, repeatable runsinteractive debugging and assistant-led workflows
State handlingexplicit state/snapshot/bundle commandsconversation/tool-call driven operations
Typical triggershell script, make target, CI pipelineprompt in Codex/Claude/Cursor

When To Use CLI

Use CLI when you need:

  • deterministic, scriptable runs
  • artifacts (snapshot create, snapshot diff, bundle create)
  • non-interactive CI jobs
  • explicit one-shot command execution in terminal
  • reliable preflight gating before app-level inspection (doctor, get_extension_rpcs)

Example:

dart run mcp_server_dart/bin/flutter_mcp_cli.dart exec --name get_vm --args '{}'

Need command patterns you can copy quickly? CLI quick recipes

When To Use MCP

Use MCP server when you need:

  • AI assistant-driven debugging loops
  • tool invocation from chat/editor agents
  • mixed workflows with screenshots, app errors, and dynamic tools during conversation

Example (conceptual):

{
  "name": "get_app_errors",
  "arguments": {}
}

Use Both Together

A common pattern:

  1. Start with CLI preflight: doctor --json and get_extension_rpcs.
  2. Use CLI for reproducible screenshot/layout/error baselines.
  3. Use MCP in editor/chat for interactive follow-up loops.
  4. Share CLI outputs/artifacts back into assistant workflows.

Decision Guide

  • Need deterministic automation, CI, or trustworthy runtime gating: use CLI first.
  • Need interactive assistant workflow right now: use MCP after CLI preflight.
  • Need both interactive and reproducible workflows: use both (CLI baseline + MCP iteration).

Important Parity Notes

  • VM target selection uses the same nested connection model in both interfaces.
  • Multi-target ambiguity returns guidance (connection_selection_required), then retry with connection.targetId.
  • Core capability definitions come from the same command catalog.
  • High-signal debugging commands are shared: discover_debug_apps, capture_ui_snapshot, inspect_widget_at_point.
  • Low-signal diagnostics (get_active_ports, dynamicRegistryStats) remain CLI-available but are not MCP-exposed by default.