[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)

Open Beginner friendly
#44,289 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, node.js, typescript
Domain
tooling

Research direction

The default output folder comes from outputDir() in packages/playwright-core/src/tools/backend/context.ts, and snapshots are written to a file from packages/playwright-core/src/tools/backend/response.ts. Start by reading how the folder is created, then check the CLI fix in packages/playwright-core/src/tools/cli-daemon/program.ts that appends .playwright-cli/ to .gitignore. Done when a server run in a fresh git repo leaves git status --porcelain clean, for example by writing .playwright-mcp/.gitignore containing *.

Written by the indexing model from the issue text.

Description

What's going on?

After browser_navigate, browser_click, browser_type and most other calls, the MCP server writes a snapshot of the page to .playwright-mcp/page-<time>.yml. When the page logs anything, its console messages go to console-<time>.log beside it. The folder is created in the workspace: the client's MCP root, or the server cwd when there is no root. For a coding agent that is the project, usually a git repository, and nothing ignores the folder:

$ git status --porcelain
?? .playwright-mcp/console-2026-11-22T00-13-19-546Z.log
?? .playwright-mcp/page-2026-11-22T00-13-19-601Z.yml

A snapshot is the text of the page. On a signed-in page that means names, e-mail addresses and account details, one git add -A away from a commit. I noticed it when the first snapshot of a session, taken on a Google account chooser, listed every signed-in address. On my own machine, 10 git repositories have this folder: 8 have a .playwright-mcp/ line added to their .gitignore, and in the other 2 it sat untracked (412 files) until I counted.

#42307 reported the same gap for the CLI, and #42318 fixed it: playwright-cli install now appends .playwright-cli/ to .gitignore, "since traces and storage state saved there can contain credentials". The MCP server has no install step, so nothing does this for .playwright-mcp/. (microsoft/playwright-mcp#1789 asked to move these files out of the workspace and was declined, with the advice to treat .playwright-mcp like .env. I am not asking to move them.)

Steps

  1. git init demo
  2. Start the server with demo as its cwd, or announce demo as the client's only MCP root.
  3. Call browser_navigate on a page that logs to the console.
  4. git -C demo status --porcelain prints the two lines above, and git check-ignore exits 1 for both files.

Expected: the default output folder stays out of git status. One way that leaves the user's .gitignore alone: when the server creates .playwright-mcp/, it also writes .playwright-mcp/.gitignore containing *, as Python's venv and pytest's cache directory do. With that file added by hand, git status in the steps above is clean.

The folder comes from outputDir(); every snapshot except an explicit browser_snapshot goes to a file.

Version

@playwright/mcp 0.0.86 (playwright-core 1.66.0-alpha-2026-11-18), and the same with playwright-core 1.66.0-alpha-2026-11-21. Windows 11, Node 24.21.0; the folder logic is not platform-specific.

Dominant language
TypeScript
Stars
100k
Forks
6.9k
Avg merge
16h 8m
Merged PRs (30d)
281

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/playwright

All issues in microsoft/playwright

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.