Skip to main content
Version: 1.x

MCP vs CLI: Choosing Your Agent Interface

Praman supports two first-class approaches for AI-driven SAP test automation: the MCP server (Model Context Protocol) and the Playwright CLI. The CLI is built into Playwright 1.59+ (includes browsers). The MCP server requires a separate install: npm install @playwright/mcp. Both produce identical gold-standard .spec.ts files using Praman fixtures.

This guide helps you choose the right approach -- or use both together.

At a Glance

DimensionMCPCLI
Included in@playwright/mcp (separate install)Playwright 1.59+ (built-in)
Token costHigher (protocol envelope per tool call)Lower (compact terminal output)
Latency per action~50--100 ms (WebSocket round-trip)~20--50 ms (direct process invocation)
SetupAdd .mcp.json to project rootAdd praman-cli.config.json
IDE supportVS Code (native), Claude Code, CopilotAny terminal-based agent
Real-time feedbackRich (inline screenshots, DOM snapshots)File-based (snapshots saved to .yml)
Session managementTied to MCP server process lifecycleNamed persistent sessions (-s=<name>)
CI/CD suitabilityNeeds running MCP serverNative (just shell commands)
Batch operationsSequential tool callsScriptable, parallelizable
Bridge injectioninitScript in MCP configinitScript in praman-cli.config.json
Output qualityGold-standard .spec.tsGold-standard .spec.ts
CLI is built in, MCP is a separate package

The Playwright CLI is built into Playwright 1.59+ -- nothing extra to install. The MCP server requires a separate package: npm install @playwright/mcp. Once installed, just choose your config.

Agent Naming Convention

Each Praman agent ships as two files -- one for MCP and one for CLI. The -cli suffix tells you which interface the agent uses:

Agent FileTypeRequires
praman-sap-planner.agent.mdMCP@playwright/mcp
praman-sap-planner-cli.agent.mdCLIBuilt into Playwright
praman-sap-generator.agent.mdMCP@playwright/mcp
praman-sap-generator-cli.agent.mdCLIBuilt into Playwright
praman-sap-healer.agent.mdMCP@playwright/mcp
praman-sap-healer-cli.agent.mdCLIBuilt into Playwright
Naming rule

Files with -cli suffix = CLI agent (no MCP server needed). Files without -cli = MCP agent.


Option A: MCP

MCP gives agents rich, interactive feedback -- inline screenshots, DOM snapshots returned directly in the conversation, and native IDE integration.

When MCP Shines

  • Interactive exploration -- stepping through a Fiori app while the agent narrates controls
  • VS Code / Copilot integration -- the Playwright MCP extension provides inline screenshots and DOM views in the sidebar
  • Real-time debugging -- inspecting page state mid-flow without saving snapshots to disk
  • First-time discovery -- when you don't know the app structure and want visual feedback
  • Demo and training -- showing stakeholders how the agent explores and generates tests

MCP Setup

First, install the MCP server package (it is not included in Playwright core):

npm install @playwright/mcp

Then add .mcp.json to your project root:

{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp", "--caps", "vision"]
}
}
}

MCP Agents

AgentClaude CodeCopilot
Planner/praman-sap-plan@praman-sap-planner
Generator/praman-sap-generate@praman-sap-generator
Healer/praman-sap-heal@praman-sap-healer
Full pipeline/praman-sap-coverage--

Option B: Playwright CLI

The CLI gives agents direct shell access to browser automation -- lower token overhead, scriptable commands, and native CI/CD integration.

When CLI Shines

  • Token-sensitive workflows -- large codebases where every token counts
  • CI/CD pipelines -- automated test generation and healing in GitHub Actions or Jenkins
  • Terminal-based agents -- any LLM agent with shell access (not just VS Code)
  • Batch generation -- running the planner across multiple Fiori apps in sequence
  • Large codebases -- CLI snapshot files avoid bloating the conversation context
  • Persistent sessions -- keeping a browser open across multiple agent invocations

CLI Setup

Create .playwright/praman-cli.config.json in your project:

{
"browser": {
"browserName": "chromium",
"initScript": ["./node_modules/playwright-praman/dist/browser/praman-bridge-init.js"]
},
"timeouts": {
"navigation": 30000,
"action": 10000
}
}

CLI Agents

AgentClaude CodeCopilot
Planner CLI/praman-cli-plan@praman-sap-planner-cli
Generator CLI/praman-cli-generate@praman-sap-generator-cli
Healer CLI/praman-cli-heal@praman-sap-healer-cli
Full pipeline/praman-cli-coverage--

CLI Strengths

  • 30--50% fewer tokens per agent session compared to MCP
  • Scriptable -- chain commands in shell scripts for batch operations
  • File-based snapshots -- agent reads only what it needs, not the full DOM
  • Named sessions -- playwright-cli -s=sap persists across commands
  • CI-native -- runs anywhere npx works, no WebSocket setup

Using Both Together

MCP and CLI are not mutually exclusive. Many teams use both depending on the task:

PhaseApproachWhy
Initial explorationMCPRich visual feedback for unknown apps
Test generationCLIToken-efficient batch generation
Interactive debuggingMCPReal-time page inspection
CI/CD healingCLIAutomated fix-and-retry in pipelines
Demo to stakeholdersMCPVisual, interactive agent session
Nightly regressionCLIBatch heal across entire test suite

Example: MCP for Discovery, CLI for Generation

# Step 1: Use MCP planner to explore the app interactively
# (in VS Code with Playwright MCP extension)
# /praman-sap-plan "Explore the Manage Purchase Orders app"

# Step 2: Switch to CLI for token-efficient generation
# /praman-cli-generate "Generate tests from tests/plans/purchase-order-plan.md"

# Step 3: Run in CI with CLI healer
npx playwright test tests/e2e/purchase-order.spec.ts || true
# /praman-cli-heal "Fix tests/e2e/purchase-order.spec.ts"

Feature Parity

Both approaches support the full Praman agent pipeline:

FeatureMCPCLINotes
SAP authenticationYesYesBoth use storageState for auth persistence
FLP navigationYesYesbrowser_navigate / playwright-cli open
UI5 control discoveryYesYesbrowser_evaluate / run-code
Bridge readiness checkYesYesSame window.__praman_bridge.ready check
Page snapshotsYesYesInline (MCP) / file-based (CLI)
ScreenshotsYesYesInline (MCP) / file-based (CLI)
Form fill + clickYesYesbrowser_fill / playwright-cli fill
Value Help workflowsYesYesSame UI5 bridge patterns
OData binding extractionYesYesSame run-code / evaluate patterns
Named sessionsNoYesCLI-only: -s=<name> for persistent state
Inline DOM in conversationYesNoMCP returns DOM directly; CLI saves to file
CI/CD without serverNoYesCLI runs as plain shell commands
Planner agentYesYesIdentical output format
Generator agentYesYesIdentical output format
Healer agentYesYesIdentical debugging approach
Full coverage pipelineYesYesBoth support plan + generate + heal cycle
Custom control supportYesYesSame bridge + run-code patterns
Fiori Elements supportYesYesSame SmartField / MDC discovery
Spec compliance checkNoYesnpx playwright-praman verify-spec <file>
Capability manifestNoYesnpx playwright-praman capabilities --agent

Recommendations

Team ProfileStart With
VS Code users with Playwright extensionMCP
Terminal-first developers (vim, tmux, CLI agents)CLI
CI/CD-heavy teams automating test generationCLI for pipelines
Mixed team with different IDEsCLI (universal)
Teams exploring SAP apps for the first timeMCP for discovery
Token-constrained environments (rate limits, budget)CLI
Teams that want both interactive and batch workflowsMCP + CLI together

Installing Agent Definitions

Both MCP and CLI agent definitions are installed via the same command:

# Install agents (CLI agents included by default)
npx playwright-praman init-agents --loop=claude

# Skip CLI agents
npx playwright-praman init-agents --loop=claude --no-cli

# Auto-detect IDE and install
npx playwright-praman init-agents

CLI agent definitions are installed by default alongside MCP agents. Pass --no-cli to skip them. Both sets coexist -- you can switch between /praman-sap-plan (MCP) and /praman-cli-plan (CLI) at any time.


Next Steps