All posts
EcosystemEngineeringBest practices

WebMCP vs Playwright MCP: What Actually Exists and What Works

WebMCP vs Playwright MCP: what exists, what doesn’t, and how to build AI-driven web automation that works today—with code, trade-offs, and tooling advice.

Agent LayerOctober 19, 202610 min read

You probably searched for “webmcp vs playwright mcp” to decide which path to use for AI-driven web automation. Short answer: there is no Playwright MCP today. Playwright has publicly declined MCP support, while WebMCP is shipping in browsers, agents, and a few frameworks. By the end of this post you’ll know what WebMCP is, what you can already ship without Playwright, and when WebMCP fits (or doesn’t) your use case.

TL;DR

  • Playwright MCP does not exist. Playwright has “no support” for MCP right now; it’s been asked for and declined. See the ecosystem tracker.
  • WebMCP is an in-page standard: pages register JSON-Schema “tools” that agents can call directly, with the user’s session and state.
  • Works today: ChatGPT desktop and ChatGPT Work call page tools; frameworks like Stagehand and Vercel’s agent-browser can run with WebMCP.
  • Best for: user-in-session actions (cart, checkout, account updates) and intent-level automation where DOM scraping is brittle.
  • Limitations: browser/agent support is still uneven; you need to feature-detect both document.modelContext and the older navigator.modelContext.

The premise problem: there is no Playwright MCP

Let’s be direct: comparing WebMCP to “Playwright MCP” rests on a feature that isn’t available. According to the verified WebMCP ecosystem status:

  • “Playwright & Playwright MCP (framework): no support – Asked for, declined for now.”

If you need an MCP-style integration for headless testing or RPA with Playwright, it’s not something you can use today. That doesn’t block you from shipping AI-driven web flows; it just changes the architecture. For browser-embedded automation with real user sessions, WebMCP is the live option. For standalone headless runs, you’ll use frameworks that do support WebMCP (e.g., Stagehand, Vercel’s agent-browser) or run agents that speak to in-page tools from a launched browser.

If you want a deeper primer on the terminology, see what is the difference between MCP and WebMCP. The short version: MCP is a backend protocol (often server/stdio) for tools; WebMCP is a client-side, in-page discovery and execution contract.

What WebMCP is (and why devs are using it)

WebMCP lets a page expose explicit actions—“tools”—with a name, description, JSON Schema input, and an async execute() function. An agent running in the browser picks tools from their descriptions and calls them, instead of guessing via DOM scraping or computer vision.

  • Tools run in the page, with the actual user’s session and UI state. No extra backend or API keys for the agent.
  • Good descriptions state when to use the tool, preconditions, and side effects. Agents choose based on these cues.
  • Register once per template (product page, cart, search, etc.) and keep results compact and serializable.

If you’re new to WebMCP, the end-to-end walkthrough in a practical WebMCP demo: register tools and run them with a real agent is a good starting point.

What you can build today without Playwright MCP

Even without Playwright MCP, you can:

  • Expose add_to_cart, update_quantity, apply_coupon, and start_checkout as tools; agents like ChatGPT desktop will call them directly in the user’s session.
  • Run agents in launched browsers via frameworks that already support WebMCP (Stagehand, Vercel agent-browser, Browser Use). Your page tools are the same.
  • Keep brittle scraping out of the loop for sensitive actions: tools mediate the change and can require in-page confirmation.

For a practical path to e‑commerce flows, see WebMCP example: concrete uses that work today.

WebMCP vs “Playwright MCP”: apples to a placeholder

Because “Playwright MCP” isn’t real, the developer decision is usually one of these:

  • WebMCP vs Traditional Playwright scripts: DOM selectors and click/type flows vs in-page tools that model user intents.
  • WebMCP vs MCP servers: run a server of tools (MCP) vs expose in-page tools (WebMCP) to act inside the user’s browser session.

There’s a detailed comparison of the second question in WebMCP vs Traditional APIs: Choosing the Right Interface for AI Agents. The gist: use MCP or classic APIs when you own the server and the flow is server-side. Use WebMCP when the source of truth is the user’s live browser state and cookies.

Architecture at a glance

This sequence diagram shows how an agent chooses a WebMCP tool and executes it in the user’s active session.

Agent discovers and calls a WebMCP tool inside a page

By contrast, “Playwright MCP” would imply a headless runner exposing tools through Playwright. That path is not available.

WebMCP in practice: minimal, safe, and testable

Here’s a compact example that registers a safe add_to_cart tool. It feature-detects both the current and older WebMCP addresses, uses JSON Schema, and requires a visible user confirmation step for a sensitive action.

// Feature-detect WebMCP (current and older address)
const mc = (document as any).modelContext ?? (navigator as any).modelContext;

if (mc) {
  mc.registerTool({
    name: "add_to_cart",
    description:
      "Add a product to the current cart. Use when the product page is loaded and a variant is selected. Shows a confirmation modal before committing.",
    inputSchema: {
      type: "object",
      properties: {
        product_id: { type: "string", description: "Internal product ID" },
        variant_id: { type: "string", description: "Variant or SKU" },
        quantity: { type: "integer", minimum: 1, default: 1 }
      },
      required: ["product_id", "variant_id"],
      additionalProperties: false
    },
    execute: async (params: any) => {
      const { product_id, variant_id, quantity = 1 } = params;

      // Preconditions: ensure page state is ready
      const productEl = document.querySelector('[data-product-id="' + product_id + '"]');
      if (!productEl) return { ok: false, error: "product_not_on_page" };

      // Show an explicit user confirmation UI for sensitive action
      const ok = await showConfirmModal(
        `Add ${quantity} to cart?`,
        `Product ${product_id} • Variant ${variant_id}`
      );
      if (!ok) return { ok: false, cancelled: true };

      // Perform the action via your existing app code
      try {
        await window.shop?.cart.add({ product_id, variant_id, quantity });
        return { ok: true, added: { product_id, variant_id, quantity } };
      } catch (e: any) {
        return { ok: false, error: "add_failed", message: String(e?.message || e) };
      }
    }
  });
}

// Minimal confirm modal helper: resolves true/false
function showConfirmModal(title: string, detail: string): Promise<boolean> {
  return new Promise((resolve) => {
    const el = document.createElement("div");
    el.innerHTML = `
      <div style="position:fixed;inset:0;background:rgba(0,0,0,0.4);display:grid;place-items:center;z-index:99999;">
        <div style="background:#fff;padding:16px;border-radius:8px;max-width:360px;">
          <h3 style="margin:0 0 8px;">${title}</h3>
          <p style="margin:0 0 16px;color:#444;">${detail}</p>
          <div style="display:flex;gap:8px;justify-content:flex-end;">
            <button id="mcp-cancel">Cancel</button>
            <button id="mcp-ok">Confirm</button>
          </div>
        </div>
      </div>`;
    document.body.appendChild(el);
    el.querySelector("#mcp-cancel")?.addEventListener("click", () => { cleanup(false); });
    el.querySelector("#mcp-ok")?.addEventListener("click", () => { cleanup(true); });
    function cleanup(v: boolean) { document.body.removeChild(el); resolve(v); }
  });
}

Notes:

  • Keep results small and JSON-serializable. Return a short success object or a clear error code.
  • Use explicit confirmation for payment, account changes, and destructive actions.
  • Describe when to use the tool and its side effects; agents really do choose based on the description text.

For a deeper setup walkthrough, see WebMCP Tutorial: Setup, Tools, and Deployment.

Where WebMCP runs today (and where it doesn’t)

The WebMCP story is early but real. Highlights from the verified ecosystem:

  • Agents: ChatGPT desktop app and ChatGPT Work call page tools today. Claude for Chrome ignores tools; Gemini in Chrome not usable yet.
  • Frameworks: Stagehand and Vercel agent-browser work today; Browser Use works on their hosted agents.
  • Browsers: Chrome and Edge have origin trials; Brave is behind a flag; Safari and Firefox have no support.

Because support is uneven, you should gate your logic with feature detection and test on the agents you care about. Track current status on the WebMCP ecosystem page. For hands-on browser specifics, read WebMCP in Chrome: what works today and how to build for it.

When WebMCP is the right tool

Use WebMCP when:

  • The source of truth is in the browser session (cart state, CSRF tokens, account locks, in-page feature flags).
  • You want agents to operate at intent level, not CSS selectors or fragile heuristics.
  • You need guardrails for sensitive operations that live inside your web app UX.

When a headless runner is better

If you’re doing nightly regression tests or scraping public, static data without a logged-in session, a traditional headless runner like Playwright still makes sense—just not “with MCP.” That’s a different tool and workflow from WebMCP.

Example tool set for a typical store

A minimal “agent-ready” store often ships these tools:

  • search_products(query)
  • add_to_cart(product_id, variant_id, quantity)
  • update_quantity(line_id, quantity)
  • apply_coupon(code)
  • start_checkout()

You can register them per page template and bind to your existing UI and state. For an implementation walkthrough in a real stack, see WebMCP for Shopify: a practical path to agentic checkout and WebMCP for WooCommerce: practical tools for agent‑driven checkout.

Operational concerns: drift, guardrails, and observability

Even with tools, production reality bites: UIs change, copy changes, and agents misinterpret intent. This is where platform support can save time.

  • Drift detection: When a selector or element moves, naive bindings break. Health checks that detect UI changes and suggest a new selector reduce outages.
  • Guardrails: Sensitive actions (payments, PII updates, deletions) should prompt for confirmation in-page. Treat this as a product requirement, not an optional nice-to-have.
  • Versioned configs and rollback: Tools change. Being able to publish per‑template configs and roll back removes blast radius.
  • Analytics and testing: You want to know which agents called what, and why it failed. Write scenarios like “intent: apply summer code” and expect the apply_coupon tool.

If you prefer not to build this plumbing yourself, Agent Layer lets you define WebMCP tools per template, ships guardrails, health checks for drift, versioned configs, analytics for every tool call, and test scenarios. It also runs a free audit that proposes tools page by page and flags common issues.

Common pitfalls

  • Assuming Playwright MCP exists: It doesn’t. If your plan depends on it, change course early. See the ecosystem status.
  • Not feature-detecting the context: Some agents still look at navigator.modelContext. Always use: const mc = document.modelContext ?? navigator.modelContext;
  • Vague tool descriptions: “Adds to cart” is not enough. State preconditions (“when on product page, variant selected”), side effects, and failure modes.
  • Oversized results: Keep results small and JSON-serializable. Don’t leak secrets or send bulky HTML.
  • No user confirmation on sensitive actions: Payments, account changes, and destructive actions should show a user-visible confirm step.
  • Tying tools to brittle selectors: Prefer calling your app’s domain functions where possible (e.g., window.shop.cart.add) and use selectors only as last resort.
  • Not testing across real agents: Tool behavior varies by agent. Use a small matrix (e.g., ChatGPT desktop, Stagehand, Vercel agent-browser) to validate.
  • Ignoring non-WebMCP readiness: Missing or invalid JSON‑LD, unlabeled fields, and CAPTCHAs still hurt agents. Run a readiness audit.

Quick comparison

Dimension WebMCP (in-page tools) “Playwright MCP”
Availability Works today in some agents, frameworks; origin trials in Chrome/Edge Not available; declined
Execution context User’s live browser session N/A
Best for Intent-level actions (cart, checkout, account) N/A
Setup Register tools in-page; no extra backend N/A
Main risks Uneven agent/browser support; drift in UI bindings N/A

A lightweight plan you can ship now

  • Add 3–5 essential tools per funnel page (search, PDP, cart, checkout start).
  • Feature-detect document.modelContext and navigator.modelContext.
  • Require in-page confirmation for sensitive actions.
  • Test with ChatGPT desktop, then one framework runner (Stagehand or Vercel agent-browser).
  • Monitor calls and iterate descriptions and schemas based on real usage.

For a pragmatic setup path, follow How to Enable WebMCP on Your Website: A Practical Guide and the WebMCP VSCode workflow guide.

What breaks in production

  • UI refactors: Renamed buttons or moved elements can silently break execute() flows if you rely on selectors. Health checks and suggested replacements help.
  • Copy changes: Agents rely on tool descriptions. If the copy diverges from reality (e.g., coupon logic changed), tools will be misused.
  • Browser gaps: Safari and Firefox have no support; Brave and Edge vary by flags and trials. Always guard with feature detection and fallbacks.
  • Agent variance: Claude for Chrome ignores tools; ChatGPT desktop uses them. Know which agents your audience actually runs.
  • CAPTCHA and interstitials: Tools can’t jump captchas; design human-in-the-loop paths or skip those pages for agent flows.

Try it

Start with the free agent‑readiness audit; it scans your site, scores four pillars, and proposes page‑level WebMCP tools: Agent Layer audit. To see where agents and browsers stand right now, check the live WebMCP ecosystem tracker. If you want guardrails, drift checks, versioned configs, analytics, and testing built in, Agent Layer’s platform is designed for that.

Get started

Don't Be Invisible to Tomorrow's Buyers.

Make your platform executable for every AI assistant your customers already use. No engineering, no lock-in, no breakage.