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

Aperta
#44,279 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
devtools, playwright, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
100k
Fork
6.9k
Merge medio
16h 8m
PR unite (30g)
281

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/playwright

Tutte le issue di microsoft/playwright

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.