MCP Playwright com Navegador Persistente
Its-Atharva-Gupta/MCP_PLaywright_Use_Logined_Browser
Navegador persistente com login reutilizável para agentes Claude
Ver no GitHubServidor MCP que executa Chromium com perfil persistente via Playwright, reutilizando cookies, localStorage e sessões autenticadas. Ideal para agentes IA que precisam manter login entre execuções, especialmente em Raspberry Pi e ambientes Debian ARM64.
Instalação
npx convez-ai Its-Atharva-Gupta/MCP_PLaywright_Use_Logined_Browser1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Automação de tarefas web com sessões autenticadas mantidas entre execuções
- Raspagem de dados de sites que requerem login
- Testes de aplicações web em ambientes headless com contexto de usuário real
Veredito

Solução técnica bem pensada para o problema específico de manter contexto de navegação entre chamadas de agentes IA. A abordagem de reutilizar o perfil do usuário é pragmática, mas exige gestão cuidadosa do ciclo de vida do processo (Chromium precisa estar fechado). Útil para workflows que precisam de autenticação persistente sem relogar a cada execução.
README
A tradução para o português deste README ainda está na fila.
playwright-persistent-mcp
playwright-persistent-mcp is a standard MCP server that drives a persistent Chromium profile with Playwright. It is designed for Raspberry Pi OS / Debian ARM64 setups where you want to reuse existing Chromium cookies, local storage, IndexedDB, and authenticated sessions later in headless mode.
By default, the server now uses your existing Chromium user data directory:
~/.config/chromium
You can override that with PLAYWRIGHT_AGENT_PROFILE_DIR.
What It Provides
The MCP server exposes these tools:
navigate(url)click(selector)fill(selector, value)screenshot(outputPath?, fullPage?)extract_text(selector?)execute_javascript(script)list_tabs()switch_tab(index)close_tab(index?)open_tab(url?)
Why This Works For Persistent Login
The implementation uses Playwright's chromium.launchPersistentContext() with a fixed Chromium user data directory. That means Playwright reuses the same on-disk browser profile every time:
- cookies stay on disk
- local storage stays on disk
- IndexedDB stays on disk
- existing sessions stay on disk
No temporary profile is created, and the configured user data directory is never deleted by the server.
Important:
- close normal Chromium before starting Playwright against the same user data directory
- do not run regular Chromium and this MCP server against the same profile at the same time
Installation
- Install system Chromium on the Pi.
sudo apt update
sudo apt install -y chromium
-
Install Node.js 20+.
-
Install the package dependencies and build it.
npm install
-
Make sure regular Chromium is fully closed if you want to reuse your existing browser cookies.
-
Start the server through
npx.
npx playwright-persistent-mcp serve
Raspberry Pi Notes
The server prefers a system Chromium binary, in this order:
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH/usr/bin/chromium/usr/bin/chromium-browser/snap/bin/chromium
This is intentional because Raspberry Pi ARM64 environments are usually more reliable with the distro Chromium package than with assumptions about bundled browser binaries.
The runtime also passes a few Chromium flags that are typically helpful on Pi and Debian systems:
--disable-dev-shm-usage--disable-gpu--no-first-run--no-default-browser-check--password-store=basic
For login compatibility, the launcher also suppresses Playwright's default --enable-automation flag. Some sites, especially Google sign-in, are more likely to reject a browser session when that flag is present.
If your environment needs sandboxing disabled, set:
export PLAYWRIGHT_AGENT_NO_SANDBOX=1
Using Your Existing Chromium Cookies
If your existing cookies already live in the default Raspberry Pi Chromium profile, you usually do not need a separate login step at all. Just make sure Chromium is closed, then run:
npx playwright-persistent-mcp serve
If your cookies are in a different Chromium user data directory, point the server at it:
export PLAYWRIGHT_AGENT_PROFILE_DIR="/path/to/chromium-user-data-dir"
npx playwright-persistent-mcp serve
Manual Login
Run:
npx playwright-persistent-mcp login
This will:
- launch Chromium in headed mode
- reuse
~/.config/chromiumby default - let you manually log into sites
- persist all browser state to disk
- finish when you close the browser
After that, the same Chromium user data directory can be reused headlessly.
Runtime Mode
Run:
npx playwright-persistent-mcp serve
This will:
- launch headless Chromium
- reuse
~/.config/chromiumby default - start the MCP server on stdio
- expose browser tools to your MCP client
MCP Client Configuration Examples
Claude Desktop
{
"mcpServers": {
"playwright-persistent": {
"command": "npx",
"args": [
"playwright-persistent-mcp",
"serve"
]
}
}
}
Codex / Generic MCP Client
{
"command": "npx",
"args": [
"playwright-persistent-mcp",
"serve"
]
}
Local Development
If you are running from the cloned project before publishing to npm:
{
"command": "node",
"args": [
"/absolute/path/to/project/dist/cli.js",
"serve"
]
}
Environment Variables
PLAYWRIGHT_AGENT_PROFILE_DIR: override the Chromium user data directoryPLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH: force a specific Chromium binaryPLAYWRIGHT_AGENT_NO_SANDBOX=1: add--no-sandboxand--disable-setuid-sandbox
Development
Build the TypeScript source:
npm run build
Operational Tips
- Close normal Chromium before running
serveif both point at the same profile. - Run
loginonly if you need to refresh a site session. - Keep the Chromium user data directory backed up if the sessions are important.
- Use a system service like
systemdif you wantserveto start automatically on boot.