Chapter 6: Standalone and Docker Deployment

March 21, 2026 ยท View on GitHub

Welcome to Chapter 6: Standalone and Docker Deployment. In this part of Playwright MCP Tutorial: Browser Automation for Coding Agents Through MCP, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.

This chapter covers deployment modes beyond basic stdio invocation.

Learning Goals

  • run Playwright MCP as a standalone HTTP MCP endpoint
  • use Docker mode for cleaner host/runtime boundaries
  • understand headless constraints in containerized mode
  • connect clients to stable local MCP endpoints

Deployment Patterns

PatternExampleBest For
standalone local servernpx @playwright/mcp@latest --port 8931multi-client local development
Docker hosted servermcr.microsoft.com/playwright/mcpcleaner runtime isolation
local stdiodefault npx modesimplest host integrations

Source References

Summary

You now have options for scaling Playwright MCP beyond default client-managed execution.

Next: Chapter 7: Tooling Surface and Automation Patterns

Source Code Walkthrough

roll.js

The doRoll function in roll.js handles a key part of this chapter's functionality:

}

function doRoll(version) {
  updatePlaywrightVersion(version);
  copyConfig();
  // update readme
  execSync('npm run lint', { cwd: __dirname, stdio: 'inherit' });
}

let version = process.argv[2];
if (!version) {
  version = execSync('npm info playwright@next version', { encoding: 'utf-8' }).trim();
  console.log(`Using next playwright version: ${version}`);
}
doRoll(version);

This function is important because it defines how Playwright MCP Tutorial: Browser Automation for Coding Agents Through MCP implements the patterns covered in this chapter.

packages/playwright-mcp/index.d.ts

The createConnection function in packages/playwright-mcp/index.d.ts handles a key part of this chapter's functionality:

import type { BrowserContext } from 'playwright';

export declare function createConnection(config?: Config, contextGetter?: () => Promise<BrowserContext>): Promise<Server>;
export {};

This function is important because it defines how Playwright MCP Tutorial: Browser Automation for Coding Agents Through MCP implements the patterns covered in this chapter.

How These Components Connect

flowchart TD
    A[doRoll]
    B[createConnection]
    A --> B