browser-pool-mcp
A dynamic browser pool MCP server that enables multiple concurrent, isolated Playwright sessions for Claude Code and other MCP clients. It manages on-demand instances on dynamic ports to resolve session conflicts and includes automatic cleanup of idle browsers.
README
browser-pool-mcp
A dynamic browser pool MCP server that wraps @playwright/mcp to enable multiple concurrent browser sessions for Claude Code and other MCP clients.
Problem Solved
The standard Playwright MCP server only allows one browser instance at a time. If you try to use browser tools from multiple Claude Code sessions simultaneously, you get:
Browser is already in use for C:\Users\...\mcp-chrome-xxx, use --isolated to run multiple instances
browser-pool-mcp solves this by:
- Spawning Playwright MCP instances on-demand on dynamic ports (9000+)
- Automatically detecting port conflicts from other sessions
- Assigning each Claude session to its own isolated browser
- Auto-cleanup of idle instances after 30 minutes
Architecture
Claude Code Session 1 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9000)
Claude Code Session 2 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9001)
Claude Code Session 3 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9002)
Each Claude Code session gets its own browser-pool-mcp process, which spawns and connects to an isolated Playwright instance on an available port.
Installation
Prerequisites
- Node.js 18+
- npm
Setup
- Clone or download this repository:
git clone https://github.com/everdijsje/browser-pool-mcp.git
cd browser-pool-mcp
npm install
- Add to your Claude Code MCP configuration (
~/.claude.json):
{
"mcpServers": {
"browser": {
"type": "stdio",
"command": "node",
"args": ["/path/to/browser-pool-mcp/index.js"]
}
}
}
- Restart Claude Code
Usage
Use browser tools as normal in Claude Code:
Navigate to https://example.com
Take a screenshot
Click on the "Learn more" link
Additional Tools
pool_status- Check the status of running browser instancespool_test- Debug tool to test async responses
Configuration
Environment variables:
| Variable | Default | Description |
|---|---|---|
BROWSER_POOL_DEBUG |
0 |
Set to 1 to enable debug logging to debug.log |
Constants in index.js:
| Constant | Default | Description |
|---|---|---|
BASE_PORT |
9000 |
Starting port for Playwright instances |
MAX_INSTANCES |
10 |
Maximum concurrent browser instances |
INSTANCE_TIMEOUT_MS |
1800000 |
Idle timeout before killing instance (30 min) |
How It Works
-
When you call any browser tool (e.g.,
browser_navigate), browser-pool-mcp:- Checks if this session already has an assigned Playwright instance
- If not, finds an available port (checking for conflicts)
- Spawns
npx @playwright/mcp@latest --port PORT --isolated - Connects via MCP SDK client over SSE
- Proxies the tool call to Playwright
-
Each session is assigned one browser instance for its lifetime
-
Instances are cleaned up after 30 minutes of inactivity
-
When max instances are reached, the oldest idle instance is recycled
Supported Browser Tools
All standard Playwright MCP tools are proxied:
browser_navigate- Navigate to URLbrowser_snapshot- Get page accessibility snapshotbrowser_click- Click elementbrowser_type- Type text into elementbrowser_screenshot- Take screenshotbrowser_tabs- Manage browser tabsbrowser_press_key- Press keyboard keybrowser_hover- Hover over elementbrowser_select_option- Select dropdown optionbrowser_evaluate- Run JavaScriptbrowser_wait_for- Wait for conditionbrowser_resize- Resize browser windowbrowser_handle_dialog- Handle alerts/confirmsbrowser_file_upload- Upload filesbrowser_console_messages- Get console logsbrowser_network_requests- Get network activitybrowser_navigate_back- Go backbrowser_close- Close browser
Dependencies
@modelcontextprotocol/sdk- MCP SDK for server and client communicationzod- Schema validation@playwright/mcp- Spawned as child processes (installed via npx)
License
MIT
Author
Built by Claude Code for Everdijs
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。