[MCP] browser_tabs list/select indices diverge across HTTP sessions with --shared-browser-context

Đang mở
#44,279 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
devtools, playwright, typescript

Hướng nghiên cứu

The report is about per-MCP-session tab registry and current-tab state in the browser_tabs tool under --shared-browser-context, so start in the MCP server's session handling and tab-index bookkeeping. Reproduce with two HTTP sessions: create a tab, list it, then select the same index from a new session. Done means indices resolve consistently across sessions or the scoping is documented; the issue has no comments or decision yet, so confirm with maintainers before changing behavior.

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

Mô tả

Environment
  • @playwright/[email protected]
  • macOS (Apple Silicon), Chrome Stable, Playwright Chrome extension
  • Server flags: --extension --shared-browser-context --background --host 127.0.0.1 --port 8931
  • MCP client reaches the HTTP endpoint through an authenticated tunnel; successive tool calls can establish new HTTP MCP sessions.
Observed behavior

With the same extension-backed Chrome browser:

  1. Tool call: browser_tabs({action:"new", url:"about:blank"}) reports the new tab (e.g. index 1).
  2. Subsequent tool call: browser_tabs({action:"list"}) displays index 1.
  3. Subsequent tool call, under another MCP session ID: browser_tabs({action:"select", index:1}).
  4. Actual: Error: Tab 1 not found.

In our test environment the tab exists in Chrome and shows in the returned listing. --shared-browser-context appears to share the underlying browser context without making the tool's per-MCP-session tab registry and current-tab state stable across new sessions.

Control / workaround

Using one persistent upstream MCP session, keeping the same Mcp-Session-Id across calls, the sequence new -> list -> select -> close passes on the same installation. A small single-operator local intermediary that holds one upstream session resolved the symptom.

The intermediary is not safe multi-tenant isolation: unrelated clients should not share unrestricted browser control. We are not asking to grant cross-client tab access implicitly.

Request

Could the behavior be clarified in documentation and/or improved with stable/selectable tab identifiers across reconnects where explicitly authorized? If list results are MCP-session-local, it would help to document the need for a persistent Mcp-Session-Id and avoid giving the impression that positional indices are usable across independently created client sessions.

Related issues

We can share a minimal HTTP harness if additional reproduction details would help.

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.