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

未关闭
#44,279 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
devtools, playwright, typescript

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
100k
派生
6.9k
平均合并
16 小时 8 分钟
30 天内合并 PR
281

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/playwright 的其他 Issue

查看 microsoft/playwright 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。