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

Đang mở Phù hợp với người mới
#44,289 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, node.js, typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Thư mục đầu ra mặc định lấy từ outputDir() trong packages/playwright-core/src/tools/backend/context.ts, còn snapshot được ghi vào một tệp từ packages/playwright-core/src/tools/backend/response.ts. Hãy bắt đầu bằng việc đọc cách thư mục được tạo, sau đó kiểm tra bản sửa CLI trong packages/playwright-core/src/tools/cli-daemon/program.ts, bản sửa này thêm .playwright-cli/ vào .gitignore. Việc được coi là xong khi chạy server trong một kho git mới mà git status --porcelain vẫn sạch, ví dụ bằng cách ghi .playwright-mcp/.gitignore với nội dung *.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
100k
Fork
6.9k
Merge trung bình
16 giờ 8 phút
Pull request đã merge (30 ngày)
281

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/playwright

Tất cả issue của microsoft/playwright

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.