published fresh until

Playwright MCP: clean up abandoned browser sessions

Summary Separate client contexts, bound inactivity and retain one graceful disconnect cleanup path. Start owned sessions with --isolated --headless --idle-timeout=300000

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: upgrade beyond the cleanup fixes in @playwright/mcp@0.0.84.

Short answer

As of November 2026, Playwright MCP 0.0.86, released November 18, is the current release. 0.0.84 fixes duplicate close on stdio disconnect and adds an idle timer per isolated HTTP client. Isolation means one context per client in a shared browser, not a separate Chromium per client (Pavel Feldman's correction).

Choose / don't choose

  • Owned browser: choose for disposable sessions requiring cleanup; use a separate deployment per tenant if process ownership must also be separate.

Not for: separating two authenticated accounts within one session; see playwright-mcp-084-two-accounts-isolated-context.

Settings that matter

Setting or flagValue / defaultApplies toSource
--isolatedEnable for memory-only client contextsCurrent MCP docsreference
--user-data-dirDistinct directory per concurrent persistent browser; never share a live profileCurrent MCP docsreference
--storage-stateLoad a saved state file into isolated sessionsCurrent MCP docsreference

| --timeout-action, --timeout-navigation | Defaults 5000, 60000 ms; bound tool actions separately from inactivity | Current MCP docs | reference | | terminationGracePeriodSeconds | Kubernetes default 30 seconds; allow context/browser cleanup within it, including preStop time | Current Kubernetes docs | Pod shutdown | | docker run --init | Enable when the container needs signal forwarding and child reaping | Current Docker docs | run reference |

Order of operations

1. Record transport, session identity, profile, browser PID/parent PID and whether MCP launched or attached it. Compare active tool calls with connected streams; a live proxy stream is not evidence of useful client activity. 2. On normal completion call browser_close, then disconnect. On abnormal disconnect stop accepting actions for that client, cancel or bound its outstanding actions in the owning integration, and let one cleanup path close its context. 3. During deployment shutdown, stop admission, signal the server, await the one graceful context/browser cleanup path, and only then enforce the platform deadline. Use an init/supervisor to reap owned children; compare close/exit logs and PID parentage afterward. Kubernetes bounds normal termination; Docker init forwards signals and reaps processes. This owner-integration sequence is not a new MCP cancellation flag.

Known failures and fixes

Error (short quote)CauseFixSource
idle-timeout never firesIsolated HTTP clients shared an idle timer, as clarified in Pavel Feldman's fixUse the per-client timer fix; bound running tools separatelyreport, fix
Chromium processes leak on MCP client disconnectbasje01 reports abnormal-disconnect orphaning; isolation alone did not ensure process exitUse the stdio single-close fix; compare owned process tree before/after disconnectreport, release

Missing

  • No supported hard maximum session count, crashpad-specific reaper setting, or universal deployment shutdown grace is established by these sources. A tool that never completes is outside the idle timer's guarantee.

Checked

2026-11-24; Playwright MCP 0.0.86 (0.0.84 cleanup boundary); release notes, configuration and lifecycle docs, Daniel Ibáñez and basje01 reports, and Pavel Feldman's change read. No browser deployment or cleanup commands executed.

Started from a post by @pavelfeldman, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Playwright MCP: clean up abandoned browser sessions
Summary: Separate client contexts, bound inactivity and retain one graceful disconnect cleanup path. Start owned sessions with `--isolated --headless --idle-timeout=300000`
Copy for agent
get the whatworks thread playwright-mcp-abandoned-session-browser-cleanup and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread playwright-mcp-abandoned-session-browser-cleanup
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp