playwright-mcp-tabbed 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SongOfHawk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # playwright-mcp-tabbed
2
+
3
+ [中文说明](./README.zh-CN.md)
4
+
5
+ ![playwright-mcp-tabbed hero](./assets/readme-hero.png)
6
+
7
+ > A tab-aware Playwright MCP server for parallel agent workflows.
8
+
9
+ `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.
10
+
11
+ ## The Problem
12
+
13
+ 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:
14
+
15
+ - Agent A selects tab 1
16
+ - Agent B selects tab 2
17
+ - Agent A's next action may accidentally run on tab 2
18
+
19
+ This project removes that shared active-tab assumption. Instead, each tool call can target a tab directly.
20
+
21
+ ## Typical Use Cases
22
+
23
+ `playwright-mcp-tabbed` is especially useful when browser automation is part of a larger agent workflow.
24
+
25
+ ### 1. Batch bug fixing
26
+
27
+ 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.
28
+
29
+ ### 2. Multi-route regression checks
30
+
31
+ 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.
32
+
33
+ ### 3. Side-by-side environment comparison
34
+
35
+ 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.
36
+
37
+ ### 4. Long workflows split across agents
38
+
39
+ 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.
40
+
41
+ ## How It Works
42
+
43
+ - One browser instance
44
+ - One shared browser context
45
+ - Many tabs
46
+ - Every browser tool call can specify `tab_index`
47
+
48
+ This gives you:
49
+
50
+ - shared cookies and login state
51
+ - stable routing to the intended tab
52
+ - better fit for multi-agent orchestration
53
+
54
+ ## Key Features
55
+
56
+ - Adds `tab_index` to nearly all browser tools
57
+ - Shares login state across tabs through one browser context
58
+ - Keeps tool names close to the official Playwright MCP naming
59
+ - Works well in Cursor and similar MCP clients
60
+ - Designed for deterministic parallel agent behavior
61
+
62
+ ## Supported Tools
63
+
64
+ - `browser_tabs`
65
+ Supports `action: "list" | "new" | "close"`
66
+ - `browser_navigate`
67
+ - `browser_snapshot`
68
+ - `browser_take_screenshot`
69
+ - `browser_run_code`
70
+ - `browser_click`
71
+ - `browser_type`
72
+ - `browser_fill_form`
73
+ - `browser_file_upload`
74
+ - `browser_hover`
75
+ - `browser_select_option`
76
+ - `browser_press_key`
77
+ - `browser_wait_for`
78
+ - `browser_evaluate`
79
+ - `browser_navigate_back`
80
+ - `browser_network_requests`
81
+ - `browser_console_messages`
82
+ - `browser_resize`
83
+ - `browser_drag`
84
+ - `browser_handle_dialog`
85
+ - `browser_close`
86
+ - `browser_install`
87
+
88
+ All tools except `browser_tabs`, `browser_close`, and `browser_install` support an optional `tab_index` argument:
89
+
90
+ ```json
91
+ {
92
+ "tab_index": 1
93
+ }
94
+ ```
95
+
96
+ ## Differences From Official `@playwright/mcp`
97
+
98
+ - `browser_tabs.select` is intentionally not implemented
99
+ - tab switching is replaced by explicit `tab_index` routing
100
+ - the design target is concurrent agent execution, not a shared active-tab interaction model
101
+
102
+ ## Quick Start
103
+
104
+ ### Install
105
+
106
+ ```bash
107
+ npm install
108
+ npm run build
109
+ ```
110
+
111
+ ### Run locally
112
+
113
+ ```bash
114
+ npm run dev
115
+ ```
116
+
117
+ ### Add to Cursor
118
+
119
+ Add this to `~/.cursor/mcp.json`:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "playwright-tabbed": {
125
+ "command": "node",
126
+ "args": [
127
+ "/absolute/path/to/playwright-mcp-tabbed/dist/index.js"
128
+ ]
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ You can keep the official `playwright` server alongside it and only use `playwright-tabbed` for concurrent browser tasks.
135
+
136
+ ## Recommended Multi-Agent Workflow
137
+
138
+ 1. The main agent logs in once.
139
+ 2. The main agent creates N tabs with `browser_tabs`.
140
+ 3. Each sub-agent receives a dedicated `tab_index`.
141
+ 4. Every browser tool call from that sub-agent includes the assigned `tab_index`.
142
+
143
+ Example:
144
+
145
+ ```json
146
+ {
147
+ "url": "http://localhost:3000",
148
+ "tab_index": 2
149
+ }
150
+ ```
151
+
152
+ ## When To Use It
153
+
154
+ Use `playwright-mcp-tabbed` when:
155
+
156
+ - you have multiple sub-agents running browser tasks at the same time
157
+ - you need shared login state across those tasks
158
+ - you want deterministic browser routing without a shared current-tab pointer
159
+
160
+ Stay with the official `@playwright/mcp` when:
161
+
162
+ - you only have one agent
163
+ - your workflow is strictly sequential
164
+ - you do not need shared tabs across concurrent tasks
165
+
166
+ ## Current Limitation
167
+
168
+ 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.
169
+
170
+ ## Media
171
+
172
+ - README cover image: `./assets/readme-hero.png`
173
+ - Source used to render the image: `./assets/readme-hero.html`
174
+
175
+ ## License
176
+
177
+ MIT
@@ -0,0 +1,177 @@
1
+ # playwright-mcp-tabbed
2
+
3
+ [English README](./README.md)
4
+
5
+ ![playwright-mcp-tabbed 封面图](./assets/readme-hero.png)
6
+
7
+ > 面向并行 Agent 工作流的 Tab 感知 Playwright MCP Server。
8
+
9
+ `playwright-mcp-tabbed` 为 Playwright MCP 工具增加了显式的 `tab_index` 能力,让多个 Agent 可以在不同标签页中并行操作,同时共享同一个浏览器上下文和登录态。
10
+
11
+ ## 要解决的问题
12
+
13
+ 官方 `@playwright/mcp` 更偏向“共享当前页面”的模型,这在单 Agent 场景下没问题,但到了并发工作流里会出现典型竞态:
14
+
15
+ - Agent A 先切到 tab 1
16
+ - Agent B 又切到 tab 2
17
+ - Agent A 的下一步操作,可能实际落到了 tab 2 上
18
+
19
+ `playwright-mcp-tabbed` 的目标就是去掉这种“共享当前 tab”的假设,让每一次工具调用都能显式指向目标标签页。
20
+
21
+ ## 典型使用场景
22
+
23
+ 这个项目最适合放在“浏览器自动化只是更大 Agent 工作流的一部分”这种场景里。
24
+
25
+ ### 1. 批量修复缺陷
26
+
27
+ 主 Agent 登录一次后,统一创建多个 tab,并把不同的 `tab_index` 分配给不同的缺陷修复子 Agent。每个子 Agent 都能在自己的标签页里独立复现、修复、验证问题,同时复用同一份登录态。
28
+
29
+ ### 2. 多路由并行回归验证
30
+
31
+ 一次重构后,让不同 Agent 同时检查 `/orders`、`/wallet`、`/settings`、`/users` 等页面,不必反复登录,也不会互相抢当前页面。
32
+
33
+ ### 3. 多环境或双版本对比
34
+
35
+ 一个 tab 打开旧版页面,一个 tab 打开新版页面,另一个 tab 打开 staging 环境。多个 Agent 可以并行做行为对比、样式对比或迁移验证。
36
+
37
+ ### 4. 拆分超长浏览器流程
38
+
39
+ 某些业务链路很长,不适合让一个 Agent 串行完成。可以把不同子流程拆到不同 tab,再分配给不同 Agent 并行执行。
40
+
41
+ ## 工作原理
42
+
43
+ - 一个浏览器实例
44
+ - 一个共享的 browser context
45
+ - 多个标签页
46
+ - 每次浏览器工具调用都可以显式指定 `tab_index`
47
+
48
+ 这样带来的直接收益是:
49
+
50
+ - 所有 tab 共享 cookie 和登录态
51
+ - 每次调用都能稳定路由到正确 tab
52
+ - 更适合多 Agent 编排
53
+
54
+ ## 核心特性
55
+
56
+ - 为绝大多数浏览器工具增加 `tab_index`
57
+ - 通过共享 browser context 复用登录状态
58
+ - 工具命名尽量贴近官方 Playwright MCP
59
+ - 适合 Cursor 和其他 MCP 客户端
60
+ - 以“并发 Agent 下的确定性行为”为设计目标
61
+
62
+ ## 已支持的工具
63
+
64
+ - `browser_tabs`
65
+ 支持 `action: "list" | "new" | "close"`
66
+ - `browser_navigate`
67
+ - `browser_snapshot`
68
+ - `browser_take_screenshot`
69
+ - `browser_run_code`
70
+ - `browser_click`
71
+ - `browser_type`
72
+ - `browser_fill_form`
73
+ - `browser_file_upload`
74
+ - `browser_hover`
75
+ - `browser_select_option`
76
+ - `browser_press_key`
77
+ - `browser_wait_for`
78
+ - `browser_evaluate`
79
+ - `browser_navigate_back`
80
+ - `browser_network_requests`
81
+ - `browser_console_messages`
82
+ - `browser_resize`
83
+ - `browser_drag`
84
+ - `browser_handle_dialog`
85
+ - `browser_close`
86
+ - `browser_install`
87
+
88
+ 除 `browser_tabs`、`browser_close`、`browser_install` 外,其余工具都支持可选参数 `tab_index`:
89
+
90
+ ```json
91
+ {
92
+ "tab_index": 1
93
+ }
94
+ ```
95
+
96
+ ## 与官方 `@playwright/mcp` 的差异
97
+
98
+ - 故意不实现 `browser_tabs.select`
99
+ - 用显式 `tab_index` 替代“切当前 tab”的模式
100
+ - 设计目标是并发 Agent 场景,而不是共享当前活动页的交互模型
101
+
102
+ ## 快速开始
103
+
104
+ ### 安装
105
+
106
+ ```bash
107
+ npm install
108
+ npm run build
109
+ ```
110
+
111
+ ### 本地开发
112
+
113
+ ```bash
114
+ npm run dev
115
+ ```
116
+
117
+ ### 在 Cursor 中配置
118
+
119
+ 把下面内容加入 `~/.cursor/mcp.json`:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "playwright-tabbed": {
125
+ "command": "node",
126
+ "args": [
127
+ "/absolute/path/to/playwright-mcp-tabbed/dist/index.js"
128
+ ]
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ 你可以保留官方 `playwright` MCP,只在并发浏览器任务里切换到 `playwright-tabbed`。
135
+
136
+ ## 推荐的多 Agent 工作流
137
+
138
+ 1. 主 Agent 先统一登录一次。
139
+ 2. 主 Agent 通过 `browser_tabs` 创建 N 个标签页。
140
+ 3. 给每个子 Agent 分配独立的 `tab_index`。
141
+ 4. 每个子 Agent 的所有浏览器工具调用都显式携带自己的 `tab_index`。
142
+
143
+ 示例:
144
+
145
+ ```json
146
+ {
147
+ "url": "http://localhost:3000",
148
+ "tab_index": 2
149
+ }
150
+ ```
151
+
152
+ ## 什么时候适合用它
153
+
154
+ 适合使用 `playwright-mcp-tabbed` 的情况:
155
+
156
+ - 有多个子 Agent 并行执行浏览器任务
157
+ - 这些任务需要共享登录态
158
+ - 你希望浏览器操作稳定落到指定 tab,而不是依赖共享当前 tab
159
+
160
+ 继续使用官方 `@playwright/mcp` 的情况:
161
+
162
+ - 只有一个 Agent
163
+ - 整个流程严格串行
164
+ - 不需要多个并发任务共享标签页和会话
165
+
166
+ ## 当前限制
167
+
168
+ 这个项目明确偏向“显式 tab 路由”,而不是“当前活动 tab”语义。如果你的调用链强依赖 `browser_tabs.select`,那它并不是完全等价替代。
169
+
170
+ ## 素材
171
+
172
+ - README 封面图:`./assets/readme-hero.png`
173
+ - 用于生成封面图的页面源码:`./assets/readme-hero.html`
174
+
175
+ ## 开源协议
176
+
177
+ MIT