## TL;DR
A headless browser launched by the server is closed after an hour without tool calls to save CPU; the next call then fails because there is no browser. Pass `--idle-timeout` (milliseconds) to raise it, or `0` to disable. Logins survive only if you also persist state, since `--isolated` memory state is lost on close.

## The error
```text
Target page, context or browser has been closed
```

## Fix it
1. **Add `--idle-timeout` to your MCP config args.** For a 5-minute window:
   ```json
   {
     "mcpServers": {
       "playwright": {
         "command": "npx",
         "args": ["@playwright/mcp@latest", "--idle-timeout=300000"]
       }
     }
   }
   ```
   Use `0` to disable the timeout entirely.
   - Expected: valid JSON.
2. **Restart the client** and run a long session.
   - Expected: the browser stays up across idle gaps up to your timeout.
3. **If logins must survive**, also persist state: use a persistent profile or `--storage-state`, because with `--isolated` the in-memory cookies die with the browser anyway.
   - Expected: re-login not needed after idle closes.

## When to use
- Browser works, then after a long idle stretch the next tool call fails with browser-closed.
- Agent sessions span hours with gaps between browser actions.

## When NOT to use
- Browser dies between rapid successive calls on 0.0.73 - that is the launchApp regression, pin 0.0.72.
- Browser never launches - check the install.

## Compatibility
- @playwright/mcp with `--idle-timeout` support.

## Root cause
An animating page costs CPU as long as the browser is open, and agent sessions last hours. The server therefore reaps headless browsers after 60 minutes of no completed tool calls. Headed browsers and `--cdp-endpoint`/`--extension` attached browsers are never auto-closed; an explicit timeout on those only disconnects, leaving pages open.

## Edge cases
- The timer never fires mid-call; it only counts completed-call idle time.
- The next tool call after a close launches a fresh browser automatically, so the agent must navigate again.
- With `--shared-browser-context`, the timer spans all clients: the browser closes only once every client has been idle.
