Skip to content
🤖 Consolidated, AI-optimized BMAD docs: llms-full.txt. Fetch this plain text file for complete context.

Configure Browser Automation

TEA can interact with live browsers during test generation — to verify selectors, explore UIs, capture evidence, and debug failures. Two complementary tools are available:

CLI and MCP are complementary tools, not competitors. Auto mode uses each where it shines — CLI for token-efficient stateless snapshots, MCP for rich stateful automation — while giving users full control to override when they know better.

TEA’s browser automation is controlled by tea_browser_automation in _bmad/tea/config.yaml:

tea_browser_automation: 'auto' # auto | cli | mcp | none
ModeBehavior
autoTEA picks the right tool per action — CLI for quick lookups, MCP for complex flows. Falls back gracefully if only one tool is installed. (Recommended)
cliCLI only. MCP ignored even if configured.
mcpMCP only. CLI ignored even if installed. Same as the old tea_use_mcp_enhancements: true.
noneNo browser interaction. TEA generates from docs and code analysis only.
Terminal window
npm install -g @playwright/cli@latest # Install globally (Node.js 18+)
playwright-cli install --skills # Register as an agent skill

The global npm install is one-time. The skills install (playwright-cli install --skills) should be run from your project root — it registers skills in your active tool’s project skills directory (for example, Claude Code uses .claude/skills/ and Codex uses .agents/skills/). Agents without skills support can still use the CLI directly via playwright-cli --help.

Add these MCP server entries to your tool’s configuration file:

{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
},
"playwright-test": {
"type": "stdio",
"command": "npx",
"args": ["playwright", "run-test-mcp-server"]
},
"smartbear": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@smartbear/mcp@latest"],
"env": {
"PACT_BROKER_BASE_URL": "https://{tenant}.pactflow.io",
"PACT_BROKER_TOKEN": "<your-api-token>"
}
}
}
}

The smartbear server is optional — only needed if you use the Pact MCP integration for contract testing workflows. See the pact-mcp knowledge fragment for details.

ToolConfig FileFormat
Claude Code~/.claude.jsonJSON (mcpServers)
Codex~/.codex/config.tomlTOML ([mcp_servers])
Gemini CLI~/.gemini/settings.jsonJSON (mcpServers)
Cursor~/.cursor/mcp.jsonJSON (mcpServers)
Windsurf~/.codeium/windsurf/mcp_config.jsonJSON (mcpServers)
VS Code (Copilot).vscode/mcp.jsonJSON (servers)

Claude Code tip: Prefer the claude mcp add CLI over manual JSON editing — it sets the correct type field and validates the config. Use -s user for global (all projects) or omit for per-project (default).

Claude Code and Codex support adding MCP servers from the command line:

Terminal window
# Claude Code — Playwright (use -s user for global, omit for per-project)
claude mcp add -s user --transport stdio playwright -- npx -y @playwright/mcp@latest
claude mcp add -s user --transport stdio playwright-test -- npx playwright run-test-mcp-server
# Claude Code — SmartBear (Pact) — use add-json for servers with env vars
claude mcp add-json -s user smartbear \
'{"type":"stdio","command":"npx","args":["-y","@smartbear/mcp@latest"],"env":{"PACT_BROKER_BASE_URL":"https://{tenant}.pactflow.io","PACT_BROKER_TOKEN":"<your-token>"}}'
# Codex — Playwright
codex mcp add playwright -- npx -y @playwright/mcp@latest
codex mcp add playwright-test -- npx playwright run-test-mcp-server
# Codex — SmartBear (Pact)
codex mcp add smartbear -- npx -y @smartbear/mcp@latest

Codex uses TOML instead of JSON. If editing the config file manually:

[mcp_servers.playwright]
command = "npx"
args = ["-y", "@playwright/mcp@latest"]
[mcp_servers.playwright-test]
command = "npx"
args = ["playwright", "run-test-mcp-server"]
[mcp_servers.smartbear]
command = "npx"
args = ["-y", "@smartbear/mcp@latest"]
[mcp_servers.smartbear.env]
PACT_BROKER_BASE_URL = "https://{tenant}.pactflow.io"
PACT_BROKER_TOKEN = "<your-api-token>"

Note the key is mcp_servers (underscored), not mcpServers.

When tea_browser_automation: "auto", TEA picks the right tool per action:

If you explicitly request CLI or MCP in your prompt (e.g., “use the CLI to explore this page”), TEA honors that.

CLI preferred for quick, stateless tasks:

  • Open page, take snapshot, list elements
  • One-shot data capture (selectors, labels, page structure)
  • Locator verification (checking if a locator exists on a page)
  • Capturing screenshots/traces for evidence

MCP preferred for stateful, multi-step flows:

  • Long sequences where state must carry across many steps
  • Multi-tab flows, file uploads, repeated edits
  • Complex interaction patterns (drag/drop, multi-step wizards)
  • Self-healing mode (analyzing failures with full DOM access)
  • If CLI returns “command not found” -> fall back to MCP
  • If MCP is unavailable -> fall back to CLI
  • If neither is available -> fall back to none mode
WorkflowDefault Tool (auto)Use Case
test-designCLIPage discovery, snapshots — stateless
atddCLI + MCPCLI for baseline capture, MCP for complex interactions
automateCLI + MCPCLI for selector verification, MCP for healing
test-reviewCLITraces, screenshots, network — stateless evidence
nfr-assessCLINetwork monitoring, timing — stateless

Even in auto mode, you can override per-request:

"Use the CLI to snapshot the login page"
"Open MCP browser and walk through the checkout wizard"

TEA will honor your explicit request.

The old boolean flag tea_use_mcp_enhancements has been replaced:

Old SettingNew Equivalent
tea_use_mcp_enhancements: truetea_browser_automation: "auto"
tea_use_mcp_enhancements: falsetea_browser_automation: "none"

The BMAD installer will auto-migrate existing configs.

Terminal window
# Verify CLI is installed
playwright-cli --version
# Install if missing
npm install -g @playwright/cli@latest
# Install skills
playwright-cli install --skills
  1. Check MCP servers are configured in your IDE
  2. Restart your IDE after configuration changes
  3. Verify: npx @playwright/mcp@latest --version

Auto mode logs its decisions:

  • “Using CLI for snapshot (stateless discovery)”
  • “Using MCP for multi-step recording (stateful flow)”

Check the workflow output for these messages.

If you see orphaned browser processes:

Terminal window
# List active sessions
playwright-cli list
# Close a specific session
playwright-cli -s=tea-explore close
# Emergency cleanup (kills ALL sessions -- use only manually)
playwright-cli close-all

Generated with BMad Method - TEA (Test Engineering Architect)