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
Steps to save Playwright MCP session artifacts:
- Create a dedicated artifact directory.
$ mkdir -p playwright-mcp-artifacts
- Start the standalone Playwright MCP server with file-backed output enabled.
$ 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.
- Point the MCP client at the printed /mcp URL.
- mcp-client-config.json
{ "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.
- Ask the MCP client to open https://example.com.
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.
- List the saved artifact files after the browser action finishes.
$ 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
- Open the saved session log to confirm the recorded tool call.
$ 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.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.