Playwright MCP browser sessions often need evidence after an agent has finished interacting with a page. Saving session artifacts gives reviewers a filesystem record of snapshots, tool calls, traces, videos, and other files instead of relying only on transient MCP responses.
The standalone MCP server writes file-backed output when it is started with an output directory. Session logs are kept when --save-session is enabled, --output-mode file stores snapshot, console, and network results as files, and --caps=devtools exposes the trace and video tools to clients that need richer evidence.
Keep the artifact directory outside source control and treat it as sensitive evidence. Session logs can include page text, URLs, prompt-visible tool arguments, and trace or video material from authenticated pages.
Related: How to run the Playwright MCP server
Related: How to view Playwright traces
Related: How to add the Playwright MCP server to Codex
$ mkdir -p playwright-mcp-artifacts
$ npx @playwright/mcp@latest --headless --port 8931 \
--output-dir playwright-mcp-artifacts \
--output-mode file \
--save-session \
--caps=devtools
Listening on http://localhost:8931
Put this in your client config:
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}
For legacy SSE transport support, you can use the /sse endpoint instead.
--output-dir chooses where files are written. --save-session records tool calls into a session folder. --caps=devtools is required for MCP trace and video tools.
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}
Keep localhost unless a separately protected remote listener is required. Leave the server terminal open while the client records artifacts.
With --output-mode file active, snapshot-style tool results are saved into the output directory. Start and stop browser_start_tracing, browser_stop_tracing, browser_start_video, and browser_stop_video around the browser action when trace or video evidence is needed.
$ find playwright-mcp-artifacts -maxdepth 2 -type f playwright-mcp-artifacts/page-2026-07-07T01-48-17-390Z.yml playwright-mcp-artifacts/session-1783388897209/session.md
$ cat playwright-mcp-artifacts/session-1783388897209/session.md ### Tool call: browser_navigate - Args ##### snipped ##### - Result ##### snipped ##### "page": "- Page URL: https://example.com/\n- Page Title: Example Domain"
Do not publish raw session logs from authenticated sites. Review and redact URLs, page text, form values, cookies, tokens, and screenshots before sharing the artifact directory.