playwright-mcp-tabbed

playwright-mcp-tabbed

A tab-aware Playwright MCP server that enables multiple agents to operate on different tabs concurrently while sharing a single browser context and login session.

Category
访问服务器

README

playwright-mcp-tabbed

中文说明

playwright-mcp-tabbed hero

A tab-aware Playwright MCP server for parallel agent workflows.

playwright-mcp-tabbed adds explicit tab_index support to Playwright MCP tools so multiple agents can operate on different tabs while sharing a single browser context and login session.

The Problem

The official @playwright/mcp model is centered around a shared active page. That is perfectly fine for single-agent flows, but it becomes fragile in concurrent workflows:

  • Agent A selects tab 1
  • Agent B selects tab 2
  • Agent A's next action may accidentally run on tab 2

This project removes that shared active-tab assumption. Instead, each tool call can target a tab directly.

Typical Use Cases

playwright-mcp-tabbed is especially useful when browser automation is part of a larger agent workflow.

1. Batch bug fixing

One main agent logs in once, opens several tabs, and assigns one tab_index to each bug-fixing sub-agent. Every sub-agent can reproduce and verify its own issue in parallel without losing authentication state.

2. Multi-route regression checks

After a refactor, different agents can validate /orders, /wallet, /settings, and /users at the same time while staying inside the same logged-in admin session.

3. Side-by-side environment comparison

One tab points to the old app, another to the migrated app, and another to a staging environment. Agents can compare behavior or styling in parallel without repeatedly logging in.

4. Long workflows split across agents

Instead of forcing one agent to serialize a long browser journey, you can split related subflows into dedicated tabs and assign them to separate agents.

How It Works

  • One browser instance
  • One shared browser context
  • Many tabs
  • Every browser tool call can specify tab_index

This gives you:

  • shared cookies and login state
  • stable routing to the intended tab
  • better fit for multi-agent orchestration

Key Features

  • Adds tab_index (and stable tab_id) to nearly all browser tools
  • Shares login state across tabs through one browser context for the same origin
  • browser_context_info explains open tabs and reminds that localhost vs 127.0.0.1 use different cookies
  • Optional PLAYWRIGHT_MCP_BASE_URL plus browser_navigate.base_url for relative paths like /dashboard
  • browser_snapshot supports root_selector and max_chars to limit MCP payload size
  • browser_click supports force, trial, and timeout (Playwright semantics)
  • browser_network_requests supports limit and url_contains
  • Keeps tool names close to the official Playwright MCP naming
  • Works well in Cursor and similar MCP clients
  • Designed for deterministic parallel agent behavior

Supported Tools

  • browser_tabs Supports action: "list" | "new" | "close"; new accepts optional label; list includes tab_id per tab
  • browser_context_info JSON summary of tabs, origins, and per-origin storage note
  • browser_navigate
  • browser_snapshot
  • browser_take_screenshot
  • browser_run_code
  • browser_click
  • browser_type
  • browser_fill_form
  • browser_file_upload
  • browser_hover
  • browser_select_option
  • browser_press_key
  • browser_wait_for
  • browser_evaluate
  • browser_navigate_back
  • browser_network_requests
  • browser_console_messages
  • browser_resize
  • browser_drag
  • browser_handle_dialog
  • browser_close
  • browser_install

Tools that target a page accept either tab_index or tab_id (mutually exclusive). Prefer tab_id when sub-agents might race on tab creation order.

{ "tab_index": 1 }
{ "tab_id": "550e8400-e29b-41d4-a716-446655440000" }

Exceptions (no tab argument): browser_tabs, browser_close, browser_install, browser_context_info.

Environment

  • PLAYWRIGHT_MCP_BASE_URL — optional default origin for relative URLs in browser_navigate (e.g. http://127.0.0.1:3000).
  • PLAYWRIGHT_MCP_RECORD_VIDEO_DIR — optional writable directory for Playwright video recording. When set, each tab/page created in the shared browser context records a video. Video files are finalized when the page or browser context closes.

Differences From Official @playwright/mcp

  • browser_tabs.select is intentionally not implemented
  • tab switching is replaced by explicit tab_index routing
  • the design target is concurrent agent execution, not a shared active-tab interaction model

Quick Start

Install via npm

npm install playwright-mcp-tabbed

Local install

git clone https://github.com/songofhawk/playwright-mcp-tabbed
cd playwright-mcp-tabbed && npm install

Add to Cursor

Add this to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "playwright-tabbed": {
      "command": "node",
      "args": ["/absolute/path/to/playwright-mcp-tabbed/dist/index.js"],
      "env": {
        "PLAYWRIGHT_MCP_RECORD_VIDEO_DIR": "/absolute/path/to/recordings"
      }
    }
  }
}

You can keep the official playwright server alongside it and only use playwright-tabbed for concurrent browser tasks.

If you do not need recording, omit env or leave PLAYWRIGHT_MCP_RECORD_VIDEO_DIR unset.

Agent skill: multi-tab orchestration

This repository includes an optional Agent Skill (for Cursor, Claude Code, and similar hosts) that documents how a main agent should create tabs, assign stable tab_ids to parallel sub-agents, and merge results—aligned with this MCP server.

  • Path in repo: skills/playwright-tabbed-orchestration/ — contains SKILL.md and helper script scripts/resolve-base-url.js.
  • Prerequisite: enable the playwright-tabbed MCP server in your client (see Add to Cursor).
  • Note: The published npm package includes dist/ and skills/; you can copy from node_modules/playwright-mcp-tabbed/skills/playwright-tabbed-orchestration after install, or clone / use GitHub subpath (below) so paths stay stable.

What the skill covers

Resolve PLAYWRIGHT_BASE_URL, open N tabs, split URL/scenario lists, spawn N sub-agents (each scoped to one tab_id), then summarize. Full steps, guardrails, and a sub-agent prompt template are in SKILL.md.

Install the skill

Cursor — copy the folder into a skills directory your Cursor version recognizes, for example:

  • Project-local: <your-project>/.cursor/skills/playwright-tabbed-orchestration/
  • Or your user-level skills path per current Cursor documentation.

Claude Code — copy to:

  • <repo>/.claude/skills/playwright-tabbed-orchestration/ (or the global skills location described in Anthropic’s docs).

OpenAI Codex — use the Codex skill-installer helper against this repository and the subpath below (adjust --ref if not on main):

python scripts/install-skill-from-github.py \
  --repo songofhawk/playwright-mcp-tabbed \
  --path skills/playwright-tabbed-orchestration

Equivalent tree URL:

https://github.com/songofhawk/playwright-mcp-tabbed/tree/main/skills/playwright-tabbed-orchestration

Restart Cursor / Codex (or reload skills) after copying or installing.

Helper: resolve-base-url.js

From the skill root:

cd skills/playwright-tabbed-orchestration
node scripts/resolve-base-url.js --help

Prints the site root URL from PLAYWRIGHT_BASE_URL (environment variable and/or git-root .env.local / .env / playwright.env.local). When resolving from project files, run with your terminal cwd on the application repository, or set PLAYWRIGHT_BASE_URL explicitly.

When To Use It

Use playwright-mcp-tabbed when:

  • you have multiple sub-agents running browser tasks at the same time
  • you need shared login state across those tasks
  • you want deterministic browser routing without a shared current-tab pointer

Stay with the official @playwright/mcp when:

  • you only have one agent
  • your workflow is strictly sequential
  • you do not need shared tabs across concurrent tasks

Current Limitation

This project intentionally favors explicit tab routing over active-tab semantics. If your tooling depends on browser_tabs.select, this server is not a drop-in replacement for that specific behavior.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选