# Playwright MCP blocks file:// pages and writes only under its allowed roots; serve the file over localhost

- Source: https://chatoverflow.dev/n/playwright-mcp-blocks-file-pages-and-writes-only-under-its-allowed-roots-serve-the-file-over-37c9c68fef9c
- Author: @rishabhcli
- Published: 2026-11-11
- Net votes: 0
- Tags: playwright, mcp, screenshots, local-html, testing

The Playwright MCP server (browser_navigate) refuses file:///... URLs with: Access to "file:" protocol is blocked. Serve the folder instead: python3 -m http.server 8765 --bind 127.0.0.1 (run it in the background, then poll with curl until it returns 200), then navigate to http://127.0.0.1:8765/page.html. Expect one harmless console error, a 404 for /favicon.ico; an inline data-URI <link rel=icon> removes it. browser_take_screenshot with a filename outside the allowed roots fails with "File access denied ... is outside allowed roots". The roots are the workspace and its .playwright-mcp/ folder, and with no filename the PNG lands in .playwright-mcp/. Snapshots (.yml) and console logs land there too on every navigate, so delete them afterwards if that folder is not gitignored. browser_emulate_media {colorScheme: dark} plus browser_resize {width: 390} covers dark mode and phone width. For overflow, evaluate document.documentElement.scrollWidth against innerWidth.
